Fix some tests and do some cleanup.

This commit is contained in:
2025-01-01 23:06:53 +01:00
parent f13508262b
commit 4deb07027f
70 changed files with 439 additions and 361 deletions

View File

@@ -21,7 +21,7 @@ COMPILED_FOLDER :: "compiled";
SEMANTIC_ANALYSIS_FOLDER :: "semant";
TESTS_FOLDER :: "test";
SHADER_EXTENSION :: "shd";
SHADER_EXTENSION :: "inx";
SUITE_EXTENSION :: "suite";
Stage_Flags :: enum_flags u16 {
@@ -411,6 +411,8 @@ run_compile_test :: (path : string, output_type : Output_Type = 0) -> Result, Co
compiler : Shader_Compiler;
result : Result;
compilation_result := compile_file(*compiler, path);
print("\n");
if compilation_result.had_error {
result.type = .Failed;
result.info_text = tprint("Failed compiling: %\n", path);
@@ -584,8 +586,11 @@ read_suite :: (file_path : string, suite : *Test_Suite) -> bool {
}
if line.count == 1 {
log_error("Invalid line - % - %\n", it_index + 1, line);
continue;
line = split(split_line, "\t");
if line.count == 1 {
log_error("Invalid line - % - \n", it_index + 1);
continue;
}
}
test_case_path := line[0];
stage_flags : Stage_Flags;
@@ -604,7 +609,6 @@ read_suite :: (file_path : string, suite : *Test_Suite) -> bool {
stage_flags |= .Compile;
}
}
test_case := make_test_case(test_case_path, stage_flags);
array_add(*suite.test_cases, test_case);
}
@@ -701,7 +705,7 @@ main :: () {
} else if arg == "-output" {
output_type |= .StdOut;
} else {
print("%Unknown argument %\n", red(), arg);
print("%Unknown argument % %\n", red(), arg, reset_color());
}
}
case .Run_Test; {
@@ -723,9 +727,11 @@ main :: () {
path := copy_string(arg);
test_case := make_test_case(path, 0);
array_add(*current_suite.test_cases, test_case);
} else {
print("%Invalid file as argument % %\n", red(), arg, reset_color());
}
} else {
print("%Unknown argument %\n", red, arg);
print("%Unknown argument % %\n", red(), arg, reset_color());
}
}
case .None; {
@@ -744,7 +750,6 @@ main :: () {
array_add(*suites, suite);
current_suite = *suites[0];
}
arg_parse_state = .Run_Test;
path := copy_string(arg);
test_case := make_test_case(path, 0);
@@ -754,7 +759,6 @@ main :: () {
log_error("Unable to run a suite while already running test.");
continue;
}
arg_parse_state = .Run_Suite;
path := copy_string(arg);
@@ -762,8 +766,10 @@ main :: () {
read_suite(path, *suite);
array_add(*suites, suite);
current_suite = *suites[0];
} else {
print("%Invalid file as argument % %\n", red(), arg, reset_color());
}
}
}
}
}
}