This commit is contained in:
Boyan 2023-10-05 11:06:11 +02:00
parent f52fb42f88
commit 9bae27c366

View File

@ -15,13 +15,16 @@ def run_input_cases(program, verbose, output):
print("Input:")
system(f"cat {input_file}")
print("")
if (out := glob(input_file.replace(".in", ".out"))[0]):
if verbose:
print("Expected output:")
system(f"cat {out}")
print("")
if output:
end_command += f" | diff {out} -"
try:
if (out := glob(input_file.replace(".in", ".out"))[0]):
if verbose:
print("Expected output:")
system(f"cat {out}")
print("")
if output:
end_command += f" | diff {out} -"
except IndexError:
pass
print(popen(end_command).read())
print("-----------")
@ -43,6 +46,8 @@ def java_compile(file_name, maven=False, verbose=False):
return
def c_compile(file_name, verbose=False, output=False):
# Style the code in Meijster's way
system("astyle -A2s2cxgk3W3xbj " + file_name)
system("gcc -Wall -pedantic --std=c99 -g -o program -lm -Wno-unused-result " + file_name)
run_input_cases("./program", verbose, output)
return