Initial Commit

This commit is contained in:
2018-03-25 22:52:29 -04:00
parent e6cdcaf629
commit ba93dced32
26 changed files with 66269 additions and 0 deletions

25
testing.py Normal file
View File

@@ -0,0 +1,25 @@
import glob, sys, subprocess
_, src, test, t = sys.argv
ig = glob.glob(f'test/{test}/*.in')
og = glob.glob(f'test/{test}/*.ans')
print(test, len(ig), 'tests')
for ifn, ofn in zip(ig, og):
with open(ifn) as fi, open(ofn) as fx:
try:
o = subprocess.check_output(['python', src],
stdin=fi, stderr=subprocess.STDOUT,
timeout=float(t))
except subprocess.CalledProcessError as e:
o = e.output
except subprocess.TimeoutExpired:
o = b'TIMED OUT'
o = o.decode().strip().replace('\r\n', '\n')
x = fx.read().strip().replace('\r\n', '\n')
if o != x:
print(ifn, 'expected:', x, 'got:', o, '=' * 50, sep='\n')