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

Function assert_name_set

tests/test_cypher.c:5355–5375  ·  view source on GitHub ↗

Runs `query` and checks that its first column holds exactly the names in * `expected`, given in strcmp order; the rows are sorted the same way so the * engine's row order does not matter. */

Source from the content-addressed store, hash-verified

5353 * `expected`, given in strcmp order; the rows are sorted the same way so the
5354 * engine's row order does not matter. */
5355static int assert_name_set(cbm_store_t *s, const char *query, const char *const *expected, int n) {
5356 enum { NAME_SET_MAX = 8 };
5357 ASSERT_TRUE(n <= NAME_SET_MAX);
5358 cbm_cypher_result_t r = {0};
5359 int rc = cbm_cypher_execute(s, query, "test", 0, &r);
5360 if (rc != 0) {
5361 printf(" query error: %s\n", r.error ? r.error : "(none)");
5362 }
5363 ASSERT_EQ(rc, 0);
5364 ASSERT_EQ(r.row_count, n);
5365 const char *names[NAME_SET_MAX];
5366 for (int i = 0; i < n; i++) {
5367 names[i] = r.rows[i][0];
5368 }
5369 qsort(names, (size_t)n, sizeof(names[0]), cmp_cstr);
5370 for (int i = 0; i < n; i++) {
5371 ASSERT_STR_EQ(names[i], expected[i]);
5372 }
5373 cbm_cypher_result_free(&r);
5374 return 0;
5375}
5376
5377/* Every spelling in `forms` is one WHERE expression; all must yield `expected`. */
5378static int where_forms_agree(cbm_store_t *s, const char *const *forms, int form_count,

Callers 2

where_forms_agreeFunction · 0.85
test_cypher.cFile · 0.85

Calls 2

cbm_cypher_executeFunction · 0.85
cbm_cypher_result_freeFunction · 0.85

Tested by

no test coverage detected