| 93 | }; |
| 94 | |
| 95 | TEST_F(CallGraphTest, SingletonComputation) { |
| 96 | // Test the call graph of a module with a single computation. |
| 97 | auto module = CreateNewVerifiedModule(); |
| 98 | HloComputation* computation = |
| 99 | module->AddEntryComputation(MakeScalarComputation()); |
| 100 | std::unique_ptr<CallGraph> call_graph = CallGraph::Build(module.get()); |
| 101 | EXPECT_EQ(1, call_graph->nodes().size()); |
| 102 | EXPECT_TRUE(call_graph->IsFlattened()); |
| 103 | |
| 104 | const CallGraphNode& node = call_graph->GetNode(computation); |
| 105 | EXPECT_EQ(computation, node.computation()); |
| 106 | EXPECT_EQ(node.depth(), 0); |
| 107 | EXPECT_TRUE(node.callsites().empty()); |
| 108 | EXPECT_TRUE(node.callees().empty()); |
| 109 | EXPECT_TRUE(node.caller_callsites().empty()); |
| 110 | EXPECT_TRUE(node.callers().empty()); |
| 111 | EXPECT_EQ(CallContext::kSequential, node.context()); |
| 112 | } |
| 113 | |
| 114 | TEST_F(CallGraphTest, UnreachableComputation) { |
| 115 | // Test the call graph of a module with an entry computation and an |
nothing calls this directly
no test coverage detected