fuck
This commit is contained in:
parent
5dbf86164a
commit
30ecc9b87c
31
ucompile
31
ucompile
@ -13,7 +13,7 @@ def check_dependencies() -> None:
|
||||
|
||||
for command in commands:
|
||||
if os.system(f"which {command} > /dev/null") != 0:
|
||||
print(f"{Fore.RED}WARNING: {command} not found{Style.RESET_ALL}")
|
||||
print(f"{Fore.ORANGE}WARNING: {command} not found{Style.RESET_ALL}")
|
||||
return
|
||||
|
||||
|
||||
@ -100,10 +100,18 @@ def run_input_cases(program, args) -> bool:
|
||||
print("❌")
|
||||
passed = False
|
||||
# green expected output and red program output
|
||||
print(f"{Fore.GREEN}Expected output:{Style.RESET_ALL}")
|
||||
print(expected_output)
|
||||
print(f"{Fore.RED}Program output:{Style.RESET_ALL}")
|
||||
print(program_output.strip())
|
||||
# print(f"{Fore.GREEN}Expected output:{Style.RESET_ALL}")
|
||||
# print(expected_output)
|
||||
# print(f"{Fore.RED}Program output:{Style.RESET_ALL}")
|
||||
# print(program_output.strip())
|
||||
# print a diff
|
||||
print(f"{Fore.YELLOW}Diff:{Style.RESET_ALL}")
|
||||
# temporary file to store program output
|
||||
with open("temp", "w") as f:
|
||||
f.write(program_output)
|
||||
os.system(f"diff -u {out_file} - < temp")
|
||||
os.remove("temp")
|
||||
|
||||
else:
|
||||
print(
|
||||
f"{Fore.YELLOW}Expected output file not found; cannot compare outputs.{Style.RESET_ALL}"
|
||||
@ -152,10 +160,15 @@ def haskell_compile(file_name, args):
|
||||
|
||||
def c_compile(file_name, args):
|
||||
# Style the code in Meijster's way
|
||||
os.system("astyle -A2s2cxgk3W3xbj " + file_name)
|
||||
os.system(
|
||||
"gcc -Wall -pedantic --std=c99 -g -o program -lm -Wno-unused-result " + file_name
|
||||
)
|
||||
# os.system("astyle -A2s2cxgk3W3xbj " + file_name)
|
||||
# If you want
|
||||
|
||||
# stop if compilation fails
|
||||
if os.system(
|
||||
"gcc -Wall -pedantic --std=c99 -g -o program -pthread -lm -Wno-unused-result " + file_name
|
||||
):
|
||||
return False
|
||||
|
||||
run_input_cases("./program", args)
|
||||
return
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user