Update run-tests.py
parent
12cb52a647
commit
0acc650224
|
@ -3,12 +3,16 @@
|
|||
import glob
|
||||
import subprocess
|
||||
import os
|
||||
import sys
|
||||
|
||||
# will break if there are namespace collisions
|
||||
|
||||
file_list = [x.rstrip(".case") for x in glob.glob(f"{os.path.dirname(__file__)}/**/*.case", recursive=True)]
|
||||
file_only_list = [os.path.basename(x) for x in file_list]
|
||||
|
||||
if sys.platform == "win32":
|
||||
subprocess.run("color") # enables ANSI escape characters, bug in Python
|
||||
|
||||
for file_name in glob.glob("*.c", recursive=False):
|
||||
if file_name.rstrip(".c") in file_only_list:
|
||||
should_continue = input(f"{file_name}; run (y/N)?").lower()
|
||||
|
@ -18,4 +22,5 @@ for file_name in glob.glob("*.c", recursive=False):
|
|||
with open(next(x for x in file_list if file_name in x)) as f:
|
||||
to_run = f.read().split("\n\n")
|
||||
for x in to_run:
|
||||
subprocess.run(["./a.out"], input="", capture_output=True)
|
||||
return_data = subprocess.run(["./a.out"], input=x[0].rstrip(), capture_output=True).stdout
|
||||
print(f"\u001b[{31 + int(return_data.rstrip() == x[1].rstrip())}m{return_data}\u001b[0m")
|
||||
|
|
Loading…
Reference in New Issue