Skip to content
Snippets Groups Projects
Commit 514dc46e authored by pycsham's avatar pycsham
Browse files

added a test auto for JE test files

parent 1709670c
No related branches found
No related tags found
No related merge requests found
import sys
from os import listdir
from os.path import isfile, join
from Scanning import scan
from Parsing import parse
import Weeding
def allFiles(testDir):
return [testDir + f for f in listdir(testDir) if isfile(join(testDir, f)) and f.startswith('J1')]
def main():
# All files in the test directory
testDirectory = "./Tests/"
testFiles = allFiles(testDirectory)
testFiles = ['./Tests/J1_IntRange_MinNegativeInt.java']
print("**********************************************************")
for f in testFiles:
# print(f)
# Scanning
content = open(f, "r").read()
(tokens, errorString) = scan(content)
# Error in Scanning
if tokens is None:
print(f)
print("ERROR in Scanning: " + errorString)
print("**********************************************************")
continue
s = "All Tokens: "
for token in tokens:
if (token.name and token.lex):
s += '(' + token.name + ',' + token.lex + '), '
print(s)
# No weeds if everything is good (weeds = None)
weeds = Weeding.fileNameCheck(tokens, f)
if weeds:
print(weeds)
continue
# Parsing
# print("Parsing starts")
try:
(steps, errorString) = parse(tokens)
except:
print("Exception in Parsing")
# Error in Parsing
if steps is None:
# print(f)
# # print("ERROR IN PARSING")
# print("ERROR in Parsing: ", errorString)
# print("**********************************************************")
continue
# print(f)
# print("Succeeded")
# print("All Steps:")
# print(steps)
print("**********************************************************")
main()
import sys
from os import listdir
from os.path import isfile, join
......@@ -6,7 +7,6 @@ from Scanning import scan
from Parsing import parse
import Weeding
def allFiles(testDir):
return [testDir + f for f in listdir(testDir) if isfile(join(testDir, f)) and f.startswith('Je')]
......@@ -51,7 +51,7 @@ def main():
(steps, errorString) = parse(tokens)
except:
print("Exception in Parsing")
# Error in Parsing
if steps is None:
# print("ERROR in Parsing: ", errorString)
......@@ -65,5 +65,4 @@ def main():
print("**********************************************************")
main()
main()
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment