-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathev_test.py
More file actions
executable file
·66 lines (54 loc) · 1.59 KB
/
ev_test.py
File metadata and controls
executable file
·66 lines (54 loc) · 1.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/usr/bin/python
from unittest import TestCase
import sys
import testoob
import ev
from test_common import test_main
from logging import debug, info, critical
STDARGS = '-p 3 -t 3 -g 3 --top 1d --timing async --neurons 5'
def main(s):
sys.argv = s.split()
ev.main()
def delete(g):
main('ev.py -f test.db -r %s -e'%g)
def create(g, args):
main('ev.py -f test.db -r %s %s'%(g, args))
def run(g):
main('ev.py -f test.db -r %s -c -m'%g)
def plot(g):
debug('testing --pf')
main('ev.py -f test.db -r %s --pf test/%s-fitness.pdf'%(g, g))
debug('testing --plotpi')
main('ev.py -f test.db -r %s --plotpi test/%s-childpi.pdf'%(g, g))
debug('testing --plotfc')
main('ev.py -f test.db -r %s --plotfc test/%s-childfc.pdf'%(g, g))
class EvTest:
def test_1_create(self):
delete(self.name)
create(self.name, STDARGS + ' ' + self.args)
def test_2_run(self):
run(self.name)
def test_3_plot(self):
plot(self.name)
def test_4_erase(self):
delete(self.name)
class Sigmoid(EvTest, TestCase):
name = 'ev_sigmoid'
args = '--model sigmoid'
class Beer(EvTest, TestCase):
name = 'ev_beer'
args = '--model beer'
class SigmoidQuanta(EvTest, TestCase):
name = 'ev_sigmoid_q'
args = '--model sigmoid -q 32'
class SteadyState(EvTest, TestCase):
name = 'ev_steadystate'
args = '--model sigmoid --ga steadystate'
class Logical(EvTest, TestCase):
name = 'ev_logical'
args = '--model logical -q 2'
class Pb(EvTest, TestCase):
name = 'ev_pb'
args = '--sim pb'
if __name__ == "__main__":
test_main()