diff --git a/tests/test_backend/test_directx/test_preprocessor.py b/tests/test_backend/test_directx/test_preprocessor.py index 41d86bf4..da3c5818 100644 --- a/tests/test_backend/test_directx/test_preprocessor.py +++ b/tests/test_backend/test_directx/test_preprocessor.py @@ -3,6 +3,7 @@ from crosstl.backend.DirectX.DirectxParser import HLSLParser from crosstl.backend.DirectX.DirectxCrossGLCodeGen import HLSLToCrossGLConverter + class TestHLSLPreprocessor: def setup_method(self): @@ -21,10 +22,10 @@ def test_include_directive(self): assert "// Included file: common.hlsl" in output def test_define_directive(self): - shader_code = '#define MAX_LIGHTS 10\nfloat4 main() : SV_Target { return MAX_LIGHTS; }' - expected_output = ( - "float4 main() : SV_Target { return 10; }" + shader_code = ( + "#define MAX_LIGHTS 10\nfloat4 main() : SV_Target { return MAX_LIGHTS; }" ) + expected_output = "float4 main() : SV_Target { return 10; }" lexer = HLSLLexer(shader_code) tokens = lexer.tokenize() parser = HLSLParser(tokens) @@ -33,10 +34,8 @@ def test_define_directive(self): assert "float4 main() : SV_Target { return 10; }" in output def test_ifdef_directive(self): - shader_code = '#ifdef MAX_LIGHTS\nfloat4 main() : SV_Target { return MAX_LIGHTS; }\n#endif' - expected_output = ( - "float4 main() : SV_Target { return MAX_LIGHTS; }" - ) + shader_code = "#ifdef MAX_LIGHTS\nfloat4 main() : SV_Target { return MAX_LIGHTS; }\n#endif" + expected_output = "float4 main() : SV_Target { return MAX_LIGHTS; }" lexer = HLSLLexer(shader_code) tokens = lexer.tokenize() parser = HLSLParser(tokens) @@ -45,14 +44,12 @@ def test_ifdef_directive(self): assert "float4 main() : SV_Target { return MAX_LIGHTS; }" in output def test_else_directive(self): - shader_code = '''#ifdef MAX_LIGHTS + shader_code = """#ifdef MAX_LIGHTS float4 main() : SV_Target { return MAX_LIGHTS; } #else float4 main() : SV_Target { return 0; } -#endif''' - expected_output = ( - "float4 main() : SV_Target { return MAX_LIGHTS; }" - ) +#endif""" + expected_output = "float4 main() : SV_Target { return MAX_LIGHTS; }" lexer = HLSLLexer(shader_code) tokens = lexer.tokenize() parser = HLSLParser(tokens) @@ -61,12 +58,10 @@ def test_else_directive(self): assert "float4 main() : SV_Target { return MAX_LIGHTS; }" in output def test_endif_directive(self): - shader_code = '''#ifdef MAX_LIGHTS + shader_code = """#ifdef MAX_LIGHTS float4 main() : SV_Target { return MAX_LIGHTS; } -#endif''' - expected_output = ( - "float4 main() : SV_Target { return MAX_LIGHTS; }" - ) +#endif""" + expected_output = "float4 main() : SV_Target { return MAX_LIGHTS; }" lexer = HLSLLexer(shader_code) tokens = lexer.tokenize() parser = HLSLParser(tokens) @@ -76,4 +71,4 @@ def test_endif_directive(self): if __name__ == "__main__": - pytest.main() \ No newline at end of file + pytest.main()