-
Notifications
You must be signed in to change notification settings - Fork 26
/
Copy pathtests.py
52 lines (38 loc) · 1.2 KB
/
tests.py
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
from lint_crn import lint_crn, find_crn
from tests_utils import emulate_crn, assert_approx, unit_test, assert_large
def make_initial(x, y):
return {
'q': 0.01,
'cxtm': 0.606,
'cytm': 0.898,
'cztm': 1.243,
'axp': 0.606,
'ayp': 0.898,
'azp': 1.243,
'mxyzm': 0.3,
'nx': 0.036 + 0.555 * x + 0.147 * y,
'ny': 0.853 - 0.517 * y,
'nz': 0.737 - 0.270 * x + 0.302 * y,
}
reactions = lint_crn(find_crn())['reactions']
@unit_test
def test_center():
initial = make_initial(0.5, 0.5)
emulate_res = emulate_crn(initial, reactions, 0.1, 100000)
assert_approx(emulate_res['R'], 2.16, 0.05)
@unit_test
def test_corner():
initial = make_initial(0.0, 0.0)
emulate_res = emulate_crn(initial, reactions, 0.1, 100000)
assert_large(emulate_res['R'])
@unit_test
def test_edge_out():
initial = make_initial(0.12, 0.5)
emulate_res = emulate_crn(initial, reactions, 0.1, 100000)
assert_large(emulate_res['R'])
@unit_test
def test_edge_in():
initial = make_initial(0.13, 0.5)
emulate_res = emulate_crn(initial, reactions, 0.1, 100000)
assert_approx(emulate_res['R'], 2.84, 0.05)
# -*- text -*-