| 273 | // D calls nothing. |
| 274 | |
| 275 | TEST(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 | |
| 295 | TEST(CallGraphTest, DirectCallees) { |
| 296 | const auto env = SPV_ENV_UNIVERSAL_1_5; |
nothing calls this directly
no test coverage detected