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

Function DoStringDiffTest

test/diff/diff_test_utils.cpp:30–54  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

28static constexpr auto kDefaultEnvironment = SPV_ENV_UNIVERSAL_1_6;
29
30void DoStringDiffTest(const std::string& src_spirv,
31 const std::string& dst_spirv,
32 const std::string& expected_diff, Options options) {
33 // Load the src and dst modules
34 std::unique_ptr<spvtools::opt::IRContext> src = spvtools::BuildModule(
35 kDefaultEnvironment, spvtools::utils::CLIMessageConsumer, src_spirv,
36 spvtools::SpirvTools::kDefaultAssembleOption |
37 SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS);
38 ASSERT_TRUE(src);
39
40 std::unique_ptr<spvtools::opt::IRContext> dst = spvtools::BuildModule(
41 kDefaultEnvironment, spvtools::utils::CLIMessageConsumer, dst_spirv,
42 spvtools::SpirvTools::kDefaultAssembleOption |
43 SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS);
44 ASSERT_TRUE(dst);
45
46 // Take the diff
47 std::ostringstream diff_result;
48 spv_result_t result =
49 spvtools::diff::Diff(src.get(), dst.get(), diff_result, options);
50 ASSERT_EQ(result, SPV_SUCCESS);
51
52 // Expect they match
53 EXPECT_EQ(diff_result.str(), expected_diff);
54}
55
56} // namespace diff
57} // namespace spvtools

Callers 15

TESTFunction · 0.85
TESTFunction · 0.85
TESTFunction · 0.85
TESTFunction · 0.85
TESTFunction · 0.85
TESTFunction · 0.85
TESTFunction · 0.85
TESTFunction · 0.85
TESTFunction · 0.85
TESTFunction · 0.85
TESTFunction · 0.85
TESTFunction · 0.85

Calls 4

DiffFunction · 0.85
getMethod · 0.80
BuildModuleFunction · 0.50
strMethod · 0.45

Tested by

no test coverage detected