-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTesting.py
More file actions
30 lines (28 loc) · 805 Bytes
/
Testing.py
File metadata and controls
30 lines (28 loc) · 805 Bytes
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
def testclause(clause, trues, falses):
notin = 0
v = 0
for i in range(len(clause)):
if abs(clause[i]) not in trues and abs(clause[i]) not in falses:
notin += 1
continue
if abs(clause[i]) in trues and clause[i] > 0:
v += 1
elif abs(clause[i]) in falses and clause[i] < 0:
v += 1
if notin > 0:
return -1
elif v > 0:
return True
elif v == 0:
return False
def test_all_clauses(clauses, trues, falses):
notyet = 0
for clause in clauses:
if testclause(clause, trues, falses) == -1:
print(clause)
notyet += 1
elif testclause(clause, trues, falses) == False:
return False
if notyet > 0:
return 'Not yet'
return True