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

Function sites_agree

tests/test_parse_coverage.c:1223–1253  ·  view source on GitHub ↗

Calls (calls=true) or usages, cut parse against full parse: * - nothing the full parse found outside the dropped rows may be missing; * - with `exact`, the cut parse may find nothing the full parse did not. * The full parse does find things INSIDE dropped rows: the SQL grammar reads * DEFAULT and a _binary introducer as identifiers, and a MySQL \' escape it * does not know turns the rest of

Source from the content-addressed store, hash-verified

1221 * full parse's error recovery around a misread escape swallows neighbouring
1222 * rows, a subquery row among them, and the cut parse no longer misreads them. */
1223static bool sites_agree(const char *src, const CBMFileResult *cut, const CBMFileResult *full,
1224 bool calls, bool exact) {
1225 cov_site_t *cs = NULL;
1226 cov_site_t *fs = NULL;
1227 int cn = collect_sites(cut, calls, &cs);
1228 int fn = collect_sites(full, calls, &fs);
1229 CBMSqlKeptRanges k = {NULL, 0};
1230 (void)cbm_sql_values_kept_ranges(src, (uint32_t)strlen(src), &k);
1231 bool ok = cs && fs;
1232 for (int i = 0; ok && exact && i < cn; i++) {
1233 if (!site_in(cs[i], fs, fn)) {
1234 fprintf(stderr, " %s only in the cut parse\n", cs[i].name);
1235 ok = false;
1236 }
1237 }
1238 for (int i = 0; ok && i < fn; i++) {
1239 if (site_in(fs[i], cs, cn)) {
1240 continue;
1241 }
1242 for (uint32_t j = 0; j < k.count; j++) {
1243 if (fs[i].start < k.items[j].end_byte && fs[i].end > k.items[j].start_byte) {
1244 fprintf(stderr, " %s lost outside the dropped rows\n", fs[i].name);
1245 ok = false;
1246 }
1247 }
1248 }
1249 cbm_sql_kept_ranges_free(&k);
1250 free(cs);
1251 free(fs);
1252 return ok;
1253}
1254
1255static int count_calls_named(const CBMFileResult *r, const char *name) {
1256 int n = 0;

Callers 1

Calls 4

collect_sitesFunction · 0.85
site_inFunction · 0.85
cbm_sql_kept_ranges_freeFunction · 0.85

Tested by

no test coverage detected