1
|
|
|
import graph.oval_graph |
2
|
|
|
import tests.any_test_help |
3
|
|
|
|
4
|
|
|
|
5
|
|
|
# AND operator |
6
|
|
|
|
7
|
|
|
|
8
|
|
|
def test_ANDTreeTrue(): |
9
|
|
|
tests.any_test_help.any_test_treeEvaluation( |
10
|
|
|
None, "true", 'ANDTreeTrue.json') |
11
|
|
|
|
12
|
|
|
|
13
|
|
|
def test_ANDTreeFalse(): |
14
|
|
|
tests.any_test_help.any_test_treeEvaluation( |
15
|
|
|
None, "false", 'ANDTreeFalse.json') |
16
|
|
|
|
17
|
|
|
|
18
|
|
|
def test_ANDTreeError(): |
19
|
|
|
tests.any_test_help.any_test_treeEvaluation( |
20
|
|
|
None, "error", 'ANDTreeError.json') |
21
|
|
|
|
22
|
|
|
|
23
|
|
|
def test_ANDTreeUnknown(): |
24
|
|
|
tests.any_test_help.any_test_treeEvaluation( |
25
|
|
|
None, "unknown", 'ANDTreeUnknown.json') |
26
|
|
|
|
27
|
|
|
|
28
|
|
|
def test_ANDTreeNoteval(): |
29
|
|
|
tests.any_test_help.any_test_treeEvaluation( |
30
|
|
|
None, "noteval", 'ANDTreeNoteval.json') |
31
|
|
|
|
32
|
|
|
|
33
|
|
|
def test_ANDTreeNotappl(): |
34
|
|
|
tests.any_test_help.any_test_treeEvaluation( |
35
|
|
|
None, "notappl", 'ANDTreeNotappl.json') |
36
|
|
|
|
37
|
|
|
# ONE operator |
38
|
|
|
|
39
|
|
|
|
40
|
|
|
def test_ONETreeTrue(): |
41
|
|
|
tests.any_test_help.any_test_treeEvaluation( |
42
|
|
|
None, "true", 'ONETreeTrue.json') |
43
|
|
|
|
44
|
|
|
|
45
|
|
|
def test_ONETreeFalse(): |
46
|
|
|
tests.any_test_help.any_test_treeEvaluation( |
47
|
|
|
None, "false", 'ONETreeFalse.json') |
48
|
|
|
|
49
|
|
|
|
50
|
|
|
def test_ONETreeFalse1(): |
51
|
|
|
tests.any_test_help.any_test_treeEvaluation( |
52
|
|
|
None, "false", 'ONETreeFalse1.json') |
53
|
|
|
|
54
|
|
|
|
55
|
|
|
def test_ONETreeError(): |
56
|
|
|
tests.any_test_help.any_test_treeEvaluation( |
57
|
|
|
None, "error", 'ONETreeError.json') |
58
|
|
|
|
59
|
|
|
|
60
|
|
|
def test_ONETreeUnknown(): |
61
|
|
|
tests.any_test_help.any_test_treeEvaluation( |
62
|
|
|
None, "unknown", 'ONETreeUnknown.json') |
63
|
|
|
|
64
|
|
|
|
65
|
|
|
def test_ONETreeNoteval(): |
66
|
|
|
tests.any_test_help.any_test_treeEvaluation( |
67
|
|
|
None, "noteval", 'ONETreeNoteval.json') |
68
|
|
|
|
69
|
|
|
|
70
|
|
|
def test_ONETreeNotappl(): |
71
|
|
|
tests.any_test_help.any_test_treeEvaluation( |
72
|
|
|
None, "notappl", 'ONETreeNotappl.json') |
73
|
|
|
|
74
|
|
|
# OR operator |
75
|
|
|
|
76
|
|
|
|
77
|
|
|
def test_ORTreeTrue(): |
78
|
|
|
tests.any_test_help.any_test_treeEvaluation( |
79
|
|
|
None, "true", 'ORTreeTrue.json') |
80
|
|
|
|
81
|
|
|
|
82
|
|
|
def test_ORTreeFalse(): |
83
|
|
|
tests.any_test_help.any_test_treeEvaluation( |
84
|
|
|
None, "false", 'ORTreeFalse.json') |
85
|
|
|
|
86
|
|
|
|
87
|
|
|
def test_ORTreeError(): |
88
|
|
|
tests.any_test_help.any_test_treeEvaluation( |
89
|
|
|
None, "error", 'ORTreeError.json') |
90
|
|
|
|
91
|
|
|
|
92
|
|
|
def test_ORTreeUnknown(): |
93
|
|
|
tests.any_test_help.any_test_treeEvaluation( |
94
|
|
|
None, "unknown", 'ORTreeUnknown.json') |
95
|
|
|
|
96
|
|
|
|
97
|
|
|
def test_ORTreeNoteval(): |
98
|
|
|
tests.any_test_help.any_test_treeEvaluation( |
99
|
|
|
None, "noteval", 'ORTreeNoteval.json') |
100
|
|
|
|
101
|
|
|
|
102
|
|
|
def test_ORTreeNotappl(): |
103
|
|
|
tests.any_test_help.any_test_treeEvaluation( |
104
|
|
|
None, "notappl", 'ORTreeNotappl.json') |
105
|
|
|
|
106
|
|
|
# XOR operator |
107
|
|
|
|
108
|
|
|
|
109
|
|
|
def test_XORTreeTrue(): |
110
|
|
|
tests.any_test_help.any_test_treeEvaluation( |
111
|
|
|
None, "true", 'XORTreeTrue.json') |
112
|
|
|
|
113
|
|
|
|
114
|
|
|
def test_XORTreeFalse(): |
115
|
|
|
tests.any_test_help.any_test_treeEvaluation( |
116
|
|
|
None, "false", 'XORTreeFalse.json') |
117
|
|
|
|
118
|
|
|
|
119
|
|
|
def test_XORTreeError(): |
120
|
|
|
tests.any_test_help.any_test_treeEvaluation( |
121
|
|
|
None, "error", 'XORTreeError.json') |
122
|
|
|
|
123
|
|
|
|
124
|
|
|
def test_XORTreeUnknown(): |
125
|
|
|
tests.any_test_help.any_test_treeEvaluation( |
126
|
|
|
None, "unknown", 'XORTreeUnknown.json') |
127
|
|
|
|
128
|
|
|
|
129
|
|
|
def test_XORTreeNoteval(): |
130
|
|
|
tests.any_test_help.any_test_treeEvaluation( |
131
|
|
|
None, "noteval", 'XORTreeNoteval.json') |
132
|
|
|
|
133
|
|
|
|
134
|
|
|
def test_XORTreeNotappl(): |
135
|
|
|
tests.any_test_help.any_test_treeEvaluation( |
136
|
|
|
None, "notappl", 'XORTreeNotappl.json') |
137
|
|
|
|
138
|
|
|
|
139
|
|
|
results_counts = { |
140
|
|
|
'true_cnt': -1, |
141
|
|
|
'false_cnt': -1, |
142
|
|
|
'error_cnt': -1, |
143
|
|
|
'unknown_cnt': -1, |
144
|
|
|
'noteval_cnt': -1, |
145
|
|
|
'notappl_cnt': -1 |
146
|
|
|
} |
147
|
|
|
|
148
|
|
|
results_counts1 = { |
149
|
|
|
'true_cnt': 3, |
150
|
|
|
'false_cnt': 3, |
151
|
|
|
'error_cnt': 3, |
152
|
|
|
'unknown_cnt': 0, |
153
|
|
|
'noteval_cnt': -1, |
154
|
|
|
'notappl_cnt': 3 |
155
|
|
|
} |
156
|
|
|
|
157
|
|
|
|
158
|
|
|
|
159
|
|
|
def test_and_or_eq_zero(): |
160
|
|
|
assert not graph.evaluate.and_or_eq_zero('and', results_counts) |
161
|
|
|
assert not graph.evaluate.and_or_eq_zero('or', results_counts) |
162
|
|
|
assert graph.evaluate.and_or_eq_zero('xor', results_counts) is None |
163
|
|
|
|
164
|
|
|
|
165
|
|
|
def test_bad_results_counts_for_operator_and(): |
166
|
|
|
assert graph.evaluate.oval_operator_and(results_counts) is None |
167
|
|
|
|
168
|
|
|
|
169
|
|
|
def test_bad_results_counts_for_operator_one(): |
170
|
|
|
assert graph.evaluate.oval_operator_one(results_counts) is None |
171
|
|
|
|
172
|
|
|
|
173
|
|
|
def test_bad_results_counts_for_operator_or(): |
174
|
|
|
assert graph.evaluate.oval_operator_or(results_counts) is None |
175
|
|
|
|
176
|
|
|
|
177
|
|
|
def test_bad_results_counts_for_operator_xor(): |
178
|
|
|
assert graph.evaluate.oval_operator_xor(results_counts) is None |
179
|
|
|
|
180
|
|
|
|
181
|
|
|
def test_false_noteval_greater_zero(): |
182
|
|
|
assert not graph.evaluate.greater_zero(results_counts, 'noteval_cnt') |
183
|
|
|
|
184
|
|
|
|
185
|
|
|
def test_false_smaller_then_two(): |
186
|
|
|
assert not graph.evaluate.smaller_than_two( |
187
|
|
|
results_counts1, 'true_cnt') |
188
|
|
|
|
189
|
|
|
def test_false_eq_zero_duo(): |
190
|
|
|
assert not graph.evaluate.eq_zero_duo(results_counts, 'noteval_cnt', 'error_cnt') |
191
|
|
|
|
192
|
|
|
def test_false_eq_or_greater_zero_unknown_noteval_notappl(): |
193
|
|
|
assert not graph.evaluate.eq_or_greater_zero_unknown_noteval_notappl( |
194
|
|
|
results_counts1) |
195
|
|
|
|
196
|
|
|
|
197
|
|
|
def test_false_error_unknown_eq_noteval_greater_zero(): |
198
|
|
|
assert not graph.evaluate.error_unknown_eq_noteval_greater_zero( |
199
|
|
|
results_counts) |
200
|
|
|
|