-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRunTestTypage.py
More file actions
72 lines (57 loc) · 2.08 KB
/
Copy pathRunTestTypage.py
File metadata and controls
72 lines (57 loc) · 2.08 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
67
68
69
70
71
72
import os
import subprocess as s
for i in range(18):
# file = "APS0_"+str(i).zfill(2)+".aps"
file = "prog"+str(i).zfill(3)+".aps"
print("Running test : " + file + " ... ", end='')
try:
parsed = str(s.check_output(["java", "-cp", "bin/", "aps.parser.ToProlog", "Test/"+file], stderr=s.STDOUT ))
except:
print("Error on parsing (or file not found) : " + file)
continue
if "error" in str(parsed).lower():
print("Error when parsing")
continue
parsed = parsed[2:len(parsed)-3]
try:
parsed = str(s.check_output(["swipl", "-s", "Typage/prog.pl", parsed ], stderr=s.STDOUT ))
print("OK", flush=True)
except:
print("Error on type check")
continue
for i in range(21):
file = "Test1/prog1"+str(i).zfill(2)+".aps"
print("Running test : " + file + " ... ", end='')
try:
parsed = str(s.check_output(["java", "-cp", "bin/", "aps.parser.ToProlog", file], stderr=s.STDOUT ))
except:
print("Error on parsing (or file not found) : " + file)
continue
if "error" in str(parsed).lower():
print("Error when parsing")
continue
parsed = parsed[2:len(parsed)-3]
try:
parsed = str(s.check_output(["swipl", "-s", "Typage/prog.pl", parsed ], stderr=s.STDOUT ))
print("OK", flush=True)
except:
print("Error on type check")
continue
for i in range(8):
file = "Test2/prog2"+str(i).zfill(2)+".aps"
print("Running test : " + file + " ... ", end='')
try:
parsed = str(s.check_output(["java", "-cp", "bin/", "aps.parser.ToProlog", file], stderr=s.STDOUT ))
except:
print("Error on parsing, this file does not respect the syntax (or file not found) : " + file)
continue
if "error" in str(parsed).lower():
print("Error when parsing")
continue
parsed = parsed[2:len(parsed)-3]
try:
parsed = str(s.check_output(["swipl", "-s", "Typage/prog.pl", parsed ], stderr=s.STDOUT ))
print("OK", flush=True)
except:
print("Error on type check")
continue