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:") print("Input:")
system(f"cat {input_file}") system(f"cat {input_file}")
print("") print("")
if (out := glob(input_file.replace(".in", ".out"))[0]): try:
if verbose: if (out := glob(input_file.replace(".in", ".out"))[0]):
print("Expected output:") if verbose:
system(f"cat {out}") print("Expected output:")
print("") system(f"cat {out}")
if output: print("")
end_command += f" | diff {out} -" if output:
end_command += f" | diff {out} -"
except IndexError:
pass
print(popen(end_command).read()) print(popen(end_command).read())
print("-----------") print("-----------")
@ -43,6 +46,8 @@ def java_compile(file_name, maven=False, verbose=False):
return return
def c_compile(file_name, verbose=False, output=False): 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) system("gcc -Wall -pedantic --std=c99 -g -o program -lm -Wno-unused-result " + file_name)
run_input_cases("./program", verbose, output) run_input_cases("./program", verbose, output)
return return