diff --git a/ucompile b/ucompile index 6d2bd67..0a3ff09 100755 --- a/ucompile +++ b/ucompile @@ -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