Skip to content

Instantly share code, notes, and snippets.

@chadluo
Created March 4, 2015 15:05
Show Gist options
  • Save chadluo/9b3a2ae0dca2256e9393 to your computer and use it in GitHub Desktop.
Save chadluo/9b3a2ae0dca2256e9393 to your computer and use it in GitHub Desktop.
tester for 3131 assignment scanner
#!/usr/bin/env python
"""test script for scanner assignment."""
import difflib
import glob
import subprocess
path = "./Scanner/*.vc"
for vc in glob.glob(path):
print("\nTesting: " + vc + "\n")
runoutdry = subprocess.Popen(["java", "VC.vc", vc],
stdout=subprocess.PIPE).stdout.readlines()
runout = [t.decode("utf-8") for t in runoutdry]
sampleout = open(vc.replace("vc", "sol")).readlines()
#for o in runout:
#print(o.replace("\n", ""))
#for o in sampleout:
#print(o.replace("\n", ""))
diff = difflib.ndiff(runout, sampleout)
print("\n".join(list(diff)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment