MCPcopy Create free account
hub / github.com/Tencent/embedx / RandomSampleNeighborTEST

Function RandomSampleNeighborTEST

src/tools/graph/dist_graph_client_main.cc:71–97  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

69}
70
71void RandomSampleNeighborTEST(const GraphClient* graph_client,
72 int test_number) {
73 int count = 3;
74 vec_int_t nodes = {0, 9};
75 std::vector<vec_int_t> neighbor_nodes_list;
76
77 vec_int_t candidates_0 = {12, 11, 10};
78 vec_int_t candidates_9 = {8, 7, 6};
79
80 for (int i = 0; i < test_number; ++i) {
81 DXCHECK(
82 graph_client->RandomSampleNeighbor(count, nodes, &neighbor_nodes_list));
83 DXCHECK(nodes.size() == neighbor_nodes_list.size());
84
85 DXCHECK(candidates_0.size() == neighbor_nodes_list[0].size());
86 for (auto node : neighbor_nodes_list[0]) {
87 DXCHECK(std::find(candidates_0.begin(), candidates_0.end(), node) !=
88 candidates_0.end());
89 }
90
91 DXCHECK(candidates_9.size() == neighbor_nodes_list[1].size());
92 for (auto node : neighbor_nodes_list[1]) {
93 DXCHECK(std::find(candidates_9.begin(), candidates_9.end(), node) !=
94 candidates_9.end());
95 }
96 }
97}
98
99void StaticTraverseTEST(const GraphClient* graph_client, int test_number) {
100 vec_int_t cur_nodes = {0, 9};

Callers 1

RunTestMethod · 0.85

Calls 1

RandomSampleNeighborMethod · 0.45

Tested by

no test coverage detected