-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtestFramework.py
54 lines (41 loc) · 1.17 KB
/
testFramework.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
import os
import testAlien
tests=[]
answers=[]
def load():
# print(os.listdir('./naq21data/alienintegers/data/secret'))
answer=True
ques=False
for file in os.listdir('./naq21data/alienintegers/data/secret'):
f = open("./naq21data/alienintegers/data/secret"+"/"+file, "r")
data=f.readlines()[0]
extension=file.split('.')[1]
data=data.replace("\n","")
data=data.replace(" ", "")
if extension=="ans":
answers.append(data)
else:
tests.append(data)
# if answer==True:
# answers.append(data)
# answer=False
# ques=True
# if ques==True:
# tests.append(data)
# ques=False
# answer=True
print(len(answers))
print(len(tests))
def runTest(toTest):
errors=0
for i in range(len(tests)):
res=toTest(tests[i])
res=res.replace(" ","")
print("Test: "+str(i))
if res!=answers[i]:
print("Expected "+answers[i])
print("But got: "+res)
errors=errors+1
print(errors)
load()
runTest(testAlien.findAlien)