MCPcopy Create free account
hub / github.com/RedisGraph/RedisGraph / test_longest_Paths

Function test_longest_Paths

tests/unit/test_all_paths.c:113–138  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

111}
112
113void test_longest_Paths() {
114 Graph *g = BuildGraph();
115
116 NodeID src_id = 0;
117 Node src;
118 Graph_GetNode(g, src_id, &src);
119
120 unsigned int minLen = 0;
121 unsigned int maxLen = UINT_MAX - 2;
122 int relationships[] = {GRAPH_NO_RELATION};
123 AllPathsCtx *ctx = AllPathsCtx_New(&src, NULL, g, relationships, 1,
124 GRAPH_EDGE_DIR_OUTGOING, minLen, maxLen, NULL, NULL, 0, false);
125 Path *path;
126
127 unsigned int longestPath = 0;
128 while((path = AllPathsCtx_NextPath(ctx))) {
129 size_t pathLen = Path_Len(path);
130 if(longestPath < pathLen) longestPath = pathLen;
131 }
132
133 // 0,1,2,3,0
134 TEST_ASSERT(longestPath == 4);
135
136 AllPathsCtx_Free(ctx);
137 Graph_Free(g);
138}
139
140void test_upToThreeLegsPaths() {
141 Graph *g = BuildGraph();

Callers

nothing calls this directly

Calls 7

Graph_GetNodeFunction · 0.85
AllPathsCtx_NewFunction · 0.85
AllPathsCtx_NextPathFunction · 0.85
Path_LenFunction · 0.85
AllPathsCtx_FreeFunction · 0.85
Graph_FreeFunction · 0.85
BuildGraphFunction · 0.70

Tested by

no test coverage detected