MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / gmt_bfs_same

Function gmt_bfs_same

tests/test_graph_mem.c:189–209  ·  view source on GitHub ↗

One BFS shape on both stores; prints the shape that diverged. */

Source from the content-addressed store, hash-verified

187
188/* One BFS shape on both stores; prints the shape that diverged. */
189static bool gmt_bfs_same(cbm_store_t *sql, cbm_store_t *mem, int64_t start, const char *dir,
190 const gmt_typeset_t *ts, int depth, int max_results, int max_edges) {
191 cbm_traverse_result_t a = {0};
192 cbm_traverse_result_t b = {0};
193 const char **types = (const char **)ts->types;
194 int rca = cbm_store_bfs_with_edge_limit(sql, start, dir, types, ts->count, depth, max_results,
195 max_edges, &a);
196 int rcb = cbm_store_bfs_with_edge_limit(mem, start, dir, types, ts->count, depth, max_results,
197 max_edges, &b);
198 bool same = rca == rcb && gmt_traverse_eq(&a, &b);
199 if (!same) {
200 (void)fprintf(stderr,
201 " graph_mem divergence: start=%lld dir=%s types=%d depth=%d max=%d "
202 "edges=%d rc=%d/%d visited=%d/%d\n",
203 (long long)start, dir, ts->count, depth, max_results, max_edges, rca, rcb,
204 a.visited_count, b.visited_count);
205 }
206 cbm_store_traverse_free(&a);
207 cbm_store_traverse_free(&b);
208 return same;
209}
210
211/* The runner initializes no memory budget unless the mem suite ran first, and
212 * without one no layer is ever built. Each test pins a budget the 3 KB fixture

Callers 2

gmt_bfs_all_shapesFunction · 0.85
test_graph_mem.cFile · 0.85

Calls 3

gmt_traverse_eqFunction · 0.85
cbm_store_traverse_freeFunction · 0.85

Tested by

no test coverage detected