MCPcopy Create free account
hub / github.com/KhronosGroup/SPIRV-Tools / TEST

Function TEST

test/diff/diff_test.cpp:49–96  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

47}
48
49TEST(DiffIndentTest, Diff) {
50 const std::string src = R"(OpCapability Shader
51 %ext_inst = OpExtInstImport "GLSL.std.450"
52 OpMemoryModel Logical GLSL450
53 OpEntryPoint Fragment %main "main"
54 OpExecutionMode %main OriginUpperLeft
55 %void = OpTypeVoid
56 %func = OpTypeFunction %void
57
58 %main = OpFunction %void None %func
59 %main_entry = OpLabel
60 OpReturn
61 OpFunctionEnd;)";
62
63 const std::string dst = R"(OpCapability Shader
64 OpMemoryModel Logical GLSL450
65 OpEntryPoint Fragment %main "main"
66 OpExecutionMode %main OriginUpperLeft
67 %void = OpTypeVoid
68 %func = OpTypeFunction %void
69
70 %main = OpFunction %void None %func
71 %main_entry = OpLabel
72 OpReturn
73 OpFunctionEnd;)";
74
75 const std::string diff = R"( ; SPIR-V
76 ; Version: 1.6
77 ; Generator: Khronos SPIR-V Tools Assembler; 0
78 ; Bound: 6
79 ; Schema: 0
80 OpCapability Shader
81- %1 = OpExtInstImport "GLSL.std.450"
82 OpMemoryModel Logical GLSL450
83 OpEntryPoint Fragment %2 "main"
84 OpExecutionMode %2 OriginUpperLeft
85 %3 = OpTypeVoid
86 %4 = OpTypeFunction %3
87 %2 = OpFunction %3 None %4
88 %5 = OpLabel
89 OpReturn
90 OpFunctionEnd
91)";
92
93 Options options;
94 options.indent = true;
95 DoStringDiffTest(src, dst, diff, options);
96}
97
98TEST(DiffNoHeaderTest, Diff) {
99 const std::string src = R"(OpCapability Shader

Callers

nothing calls this directly

Calls 9

DoStringDiffTestFunction · 0.85
AssembleFunction · 0.85
DiffFunction · 0.85
schemaMethod · 0.80
SetHeaderMethod · 0.80
getMethod · 0.80
IdBoundMethod · 0.45
moduleMethod · 0.45
strMethod · 0.45

Tested by

no test coverage detected