-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTest.py
More file actions
37 lines (36 loc) · 1.26 KB
/
Test.py
File metadata and controls
37 lines (36 loc) · 1.26 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
import os, sys, subprocess
input = "Tests/input_"
output = "Tests/output_"
extension = ".txt"
expected = "Expected : "
function = "python3 sbml_old.py "
sbml = "SBML output: "
start = 1
stop = 41
count = 0
attempted = 0
if len(sys.argv) == 2:
start = int(sys.argv[1])
stop = int(start) + 1
elif len(sys.argv) == 3:
start = int(sys.argv[1])
stop = int(sys.argv[2])
for i in range(start, stop):
attempted += 1
inputFile = open(input + i.__str__() + extension, 'r')
outputFile = open(output + i.__str__() + extension, 'r')
expression = inputFile.read()
expectedOutput = outputFile.read()
print("\n" + input + i.__str__() + extension + " : "+ expression)
print(expected + expectedOutput)
print(sbml, end="")
# sbmlOutput = subprocess.check_output(function + input + i.__str__() + extension, shell=True)
sbmlOutput = os.popen(function + input + i.__str__() + extension).read()
sbmlOutput = sbmlOutput[:len(sbmlOutput)-1]
print(sbmlOutput)
if sbmlOutput.lower() == expectedOutput.lower():
count += 1
print("CORRECT: " + count.__str__() + '/' + attempted.__str__())
else:
print("INCORRECT: " + count.__str__() + '/' + attempted.__str__())
print("TOTAL: " + count.__str__() + '/' + attempted.__str__())