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

Function TEST

test/fuzz/call_graph_test.cpp:275–293  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

273// D calls nothing.
274
275TEST(CallGraphTest, FunctionInDegree) {
276 const auto env = SPV_ENV_UNIVERSAL_1_5;
277 const auto consumer = nullptr;
278
279 const auto context = BuildModule(env, consumer, shader, kFuzzAssembleOption);
280 spvtools::ValidatorOptions validator_options;
281 ASSERT_TRUE(fuzzerutil::IsValidAndWellFormed(context.get(), validator_options,
282 kConsoleMessageConsumer));
283
284 const auto graph = CallGraph(context.get());
285
286 const auto& function_in_degree = graph.GetFunctionInDegree();
287 // Check the in-degrees of, in order: main, A, B, C, D.
288 ASSERT_EQ(function_in_degree.at(2), 0);
289 ASSERT_EQ(function_in_degree.at(35), 3);
290 ASSERT_EQ(function_in_degree.at(48), 1);
291 ASSERT_EQ(function_in_degree.at(50), 2);
292 ASSERT_EQ(function_in_degree.at(61), 1);
293}
294
295TEST(CallGraphTest, DirectCallees) {
296 const auto env = SPV_ENV_UNIVERSAL_1_5;

Callers

nothing calls this directly

Calls 6

IsValidAndWellFormedFunction · 0.85
getMethod · 0.80
GetIndirectCalleesMethod · 0.80
BuildModuleFunction · 0.50
CallGraphClass · 0.50

Tested by

no test coverage detected