equal
deleted
inserted
replaced
57 |
57 |
58 // running the c-compiler over the transpiled |
58 // running the c-compiler over the transpiled |
59 // BF program and running the resulting binary |
59 // BF program and running the resulting binary |
60 |
60 |
61 def compile_and_run(prog: String) = { |
61 def compile_and_run(prog: String) = { |
62 val tn = "tmp" |
62 val hash = java.util.UUID.randomUUID().toString.take(4) |
|
63 val tn = s"tmp_$hash" |
63 compile_to_file(s"${tn}.c", prog) |
64 compile_to_file(s"${tn}.c", prog) |
64 os.proc("gcc", "-O0", "-o", tn, s"${tn}.c").call() // call gcc |
65 os.proc("gcc", "-O0", "-o", tn, s"${tn}.c").call() // call gcc |
65 os.proc("./tmp").call(stdout = os.Inherit) // run binary |
66 os.proc(os.pwd / s"${tn}").call(stdout = os.Inherit) // run binary |
66 } |
67 } |
67 |
68 |
68 // Running Testcases |
69 // Running Testcases |
69 //=================== |
70 //=================== |
70 |
71 |