| 111 | } |
| 112 | |
| 113 | void 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 | |
| 140 | void test_upToThreeLegsPaths() { |
| 141 | Graph *g = BuildGraph(); |
nothing calls this directly
no test coverage detected