Fix some bugs from last time, which I committed to make sure it didn't delete anything...
This commit is contained in:
@@ -101,6 +101,8 @@ fun file_exists(path: string::string): bool {
|
|||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
fun read_file(path: string::string): string::string {
|
fun read_file(path: string::string): string::string {
|
||||||
|
if (!file_exists(path))
|
||||||
|
return string::string()
|
||||||
var toRet.construct(read_file_binary(path)): string::string
|
var toRet.construct(read_file_binary(path)): string::string
|
||||||
return toRet
|
return toRet
|
||||||
}
|
}
|
||||||
|
|||||||
4
tests/new_runner.sh
Normal file → Executable file
4
tests/new_runner.sh
Normal file → Executable file
@@ -1,6 +1,6 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
runner_path="./test_runner/test_runner"
|
runner_path="./tester/tester"
|
||||||
#testDir=${1:-"../tests"}
|
#testDir=${1:-"../tests"}
|
||||||
testDir="."
|
testDir="."
|
||||||
ext=${2:-"krak"}
|
ext=${2:-"krak"}
|
||||||
@@ -12,4 +12,4 @@ for dir in `find ${testDir} -type f -name "test_*.${ext}"`; do
|
|||||||
fileList+=\ $testDir\/$filename
|
fileList+=\ $testDir\/$filename
|
||||||
done
|
done
|
||||||
|
|
||||||
${runner_path} "--test" ${fileList}
|
${runner_path} ${fileList}
|
||||||
|
|||||||
@@ -29,19 +29,20 @@ fun main(argc: int, argv: **char): int {
|
|||||||
var results_file_name = test_name + ".results"
|
var results_file_name = test_name + ".results"
|
||||||
var expected_results_file_name = test_name + ".expected_results"
|
var expected_results_file_name = test_name + ".expected_results"
|
||||||
if (system(string("./") + test_name + ".krak.exe > " + results_file_name)) error("could not run")
|
if (system(string("./") + test_name + ".krak.exe > " + results_file_name)) error("could not run")
|
||||||
if (read_file(results_file_name) == read_file(expected_results_file_name)) {
|
if (file_exists(results_file_name) && file_exists(expected_results_file_name) && read_file(results_file_name) == read_file(expected_results_file_name)) {
|
||||||
println(test_name + "\tPASSED!")
|
println(test_name + "\tPASSED!")
|
||||||
all_results += pad_with_spaces(test_name) + "\tPASSED!\n"
|
all_results += pad_with_spaces(test_name) + "\tPASSED!\n"
|
||||||
num_passed++
|
num_passed++
|
||||||
system(string("rm ./") + results_file_name)
|
system(string("rm ./") + results_file_name)
|
||||||
} else {
|
} else {
|
||||||
println(test_name + "\tFAILED!")
|
println(test_name + "\tFAILED!")
|
||||||
all_results += pad_with_spaces(test_name) + "\tFAILED!\n"
|
all_results += pad_with_spaces(test_name) + "\tFAILED!!!\n"
|
||||||
}
|
}
|
||||||
system(string("rm ./") + test_name + ".krak.*")
|
system(string("rm ./") + test_name + ".krak.*")
|
||||||
}
|
}
|
||||||
println(string("\n\nTEST RESULTS: ") + num_passed + "/" + (argc-1))
|
println(string("\n\nTEST RESULTS: ") + num_passed + "/" + (argc-1))
|
||||||
println(all_results)
|
println(all_results)
|
||||||
|
println(string("TEST RESULTS: ") + num_passed + "/" + (argc-1))
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
Reference in New Issue
Block a user