Fix some bugs from last time, which I committed to make sure it didn't delete anything...

This commit is contained in:
Nathan Braswell
2016-02-05 05:11:02 -05:00
parent dd34de7c88
commit 464805b7aa
3 changed files with 7 additions and 4 deletions

View File

@@ -101,6 +101,8 @@ fun file_exists(path: string::string): bool {
return result
}
fun read_file(path: string::string): string::string {
if (!file_exists(path))
return string::string()
var toRet.construct(read_file_binary(path)): string::string
return toRet
}

4
tests/new_runner.sh Normal file → Executable file
View File

@@ -1,6 +1,6 @@
#!/bin/bash
runner_path="./test_runner/test_runner"
runner_path="./tester/tester"
#testDir=${1:-"../tests"}
testDir="."
ext=${2:-"krak"}
@@ -12,4 +12,4 @@ for dir in `find ${testDir} -type f -name "test_*.${ext}"`; do
fileList+=\ $testDir\/$filename
done
${runner_path} "--test" ${fileList}
${runner_path} ${fileList}

View File

@@ -29,19 +29,20 @@ fun main(argc: int, argv: **char): int {
var results_file_name = test_name + ".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 (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!")
all_results += pad_with_spaces(test_name) + "\tPASSED!\n"
num_passed++
system(string("rm ./") + results_file_name)
} else {
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.*")
}
println(string("\n\nTEST RESULTS: ") + num_passed + "/" + (argc-1))
println(all_results)
println(string("TEST RESULTS: ") + num_passed + "/" + (argc-1))
return 0
}