Simplified shader test output
This commit is contained in:
1
AST.jai
1
AST.jai
@@ -283,7 +283,6 @@ pretty_print_variable :: (node : *AST_Node, indentation : int, builder : *String
|
||||
print_to_builder(builder, "%", node.name);
|
||||
|
||||
for child : node.children {
|
||||
print("%\n", child.kind);
|
||||
if child.kind == .Variable {
|
||||
append(builder, ".");
|
||||
pretty_print_variable(child, indentation, builder);
|
||||
|
||||
@@ -386,7 +386,11 @@ emit_node :: (state : *Codegen_State, node : *AST_Node, indentation : int) {
|
||||
}
|
||||
case .Binary; {
|
||||
indent(*state.builder, indentation);
|
||||
|
||||
if node.token.kind != .TOKEN_ASSIGN {
|
||||
append(*state.builder, "(");
|
||||
}
|
||||
|
||||
lhs := node.children[0];
|
||||
rhs := node.children[1];
|
||||
emit_node(state, lhs, 0);
|
||||
@@ -395,8 +399,10 @@ emit_node :: (state : *Codegen_State, node : *AST_Node, indentation : int) {
|
||||
emit_operator(state, node.token.kind);
|
||||
append(*state.builder, " ");
|
||||
emit_node(state, rhs, 0);
|
||||
if node.token.kind != .TOKEN_ASSIGN {
|
||||
append(*state.builder, ")");
|
||||
}
|
||||
}
|
||||
case .Unary; {
|
||||
assert(false, "Not implemented yet: unary");
|
||||
}
|
||||
|
||||
44
Test.jai
44
Test.jai
@@ -310,8 +310,8 @@ run_semantic_analysis_test :: (file_path : string, root : *AST_Node, output_type
|
||||
result_text = pretty_print_symbol_table(*checker, temp);
|
||||
constraints := pretty_print_type_constraints(*checker, temp);
|
||||
type_vars := pretty_print_type_variables(*checker, temp);
|
||||
print("Constraints\n%\n", constraints);
|
||||
print("Solution\n%\n", type_vars);
|
||||
// print("Constraints\n%\n", constraints);
|
||||
// print("Solution\n%\n", type_vars);
|
||||
}
|
||||
|
||||
if output_type & .StdOut {
|
||||
@@ -477,7 +477,23 @@ run_test :: (file_path : string, stage_flags : Stage_Flags, results : *[..]Resul
|
||||
}
|
||||
|
||||
run_test :: (test_case : Test_Case, results : *[..]Result, output_type : Output_Type = 0) {
|
||||
print("%Running test: %\n", cyan(), test_case.path);
|
||||
print("%Running test: %......", cyan(), test_case.path);
|
||||
|
||||
// path 30
|
||||
// len 35
|
||||
// == 5
|
||||
|
||||
|
||||
// path 20
|
||||
// len = 35
|
||||
// == 15
|
||||
|
||||
len := 50;
|
||||
rest := len - test_case.path.count;
|
||||
for i: 0..rest {
|
||||
print(" ");
|
||||
}
|
||||
|
||||
run_test(test_case.path, test_case.stage_flags, results, output_type);
|
||||
}
|
||||
|
||||
@@ -525,7 +541,7 @@ run_test_suite :: (using suite : *Test_Suite, output_type : Output_Type = 0) {
|
||||
}
|
||||
}
|
||||
|
||||
print("\n");
|
||||
// print("\n");
|
||||
}
|
||||
print("\n");
|
||||
|
||||
@@ -620,26 +636,26 @@ evaluate_result :: (result : Result) {
|
||||
|
||||
if #complete result.type == {
|
||||
case .File_Read_Failed; {
|
||||
print("%", red());
|
||||
print("% failed with File_Read_Failed\n", result.path);
|
||||
print(" %", red());
|
||||
print("failed with File_Read_Failed\n");
|
||||
}
|
||||
case .Golden_File_Not_Found; {
|
||||
print("%", red());
|
||||
print("% failed with Golden File Not Found for stage %\n", result.path, stage);
|
||||
print(" %", red());
|
||||
print("failed with Golden File Not Found for stage %\n", stage);
|
||||
}
|
||||
case .StdOut; {
|
||||
}
|
||||
case .Golden_Output; {
|
||||
print("%", yellow());
|
||||
print("% output new golden file at %\n", result.path, result.golden_path);
|
||||
print(" %", yellow());
|
||||
print("output new golden file at %\n", result.golden_path);
|
||||
}
|
||||
case .Passed; {
|
||||
print("%", green());
|
||||
print("% passed %\n", result.path, stage);
|
||||
print(" %", green());
|
||||
print("passed %\n", stage);
|
||||
}
|
||||
case .Failed; {
|
||||
print("%", red());
|
||||
print("% failed %\n", result.path, stage);
|
||||
print(" %", red());
|
||||
print("failed %\n", stage);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
void vs_main()
|
||||
{
|
||||
float x = 2.0f + 5.0f;
|
||||
float x = (2.0f + 5.0f);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,6 @@ void vs_main()
|
||||
{
|
||||
float x = 5.0f;
|
||||
float y = 3000.0f;
|
||||
float z = y * y + x;
|
||||
float z = ((y * y) + x);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,2 @@
|
||||
struct Foo;
|
||||
|
||||
struct Foo {}
|
||||
struct Foo {};
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ cbuffer __PROPERTIES : register(b0)
|
||||
}
|
||||
|
||||
|
||||
float3 vs_main(float3 pos : POSITION, float2 uv) : SV_POSITION
|
||||
float3 vs_main(float3 pos : POSITION, float2 uv : TEXCOORD0) : SV_POSITION
|
||||
{
|
||||
return pos;
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ int foo()
|
||||
|
||||
float bar()
|
||||
{
|
||||
return 1235.0f * 500;
|
||||
return (1235.0f * 500);
|
||||
}
|
||||
|
||||
void vs_main()
|
||||
|
||||
@@ -1,15 +1,13 @@
|
||||
struct Foo;
|
||||
|
||||
float foo(Foo f);
|
||||
|
||||
struct Foo
|
||||
{
|
||||
float some_data;
|
||||
}
|
||||
};
|
||||
|
||||
float foo(Foo f)
|
||||
{
|
||||
return f.some_data * 2.0f;
|
||||
return (f.some_data * 2.0f);
|
||||
}
|
||||
|
||||
void vs_main()
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
struct Data;
|
||||
|
||||
struct Data
|
||||
{
|
||||
float4 color;
|
||||
}
|
||||
};
|
||||
|
||||
void vs_main()
|
||||
{
|
||||
|
||||
@@ -1,15 +1,12 @@
|
||||
struct Foo;
|
||||
struct Bar;
|
||||
|
||||
struct Foo
|
||||
{
|
||||
float4 color;
|
||||
}
|
||||
};
|
||||
|
||||
struct Bar
|
||||
{
|
||||
Foo t;
|
||||
}
|
||||
};
|
||||
|
||||
void vs_main()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user