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

Function ref_rows_in_order

tests/test_cypher.c:5663–5679  ·  view source on GitHub ↗

`sorted` must hold the rows of `unsorted` in the reference order. */

Source from the content-addressed store, hash-verified

5661
5662/* `sorted` must hold the rows of `unsorted` in the reference order. */
5663static bool ref_rows_in_order(const cbm_cypher_result_t *sorted,
5664 const cbm_cypher_result_t *unsorted, ref_cmp_fn cmp) {
5665 if (sorted->row_count != unsorted->row_count || sorted->col_count != unsorted->col_count ||
5666 unsorted->row_count < REF_NODES) {
5667 return false;
5668 }
5669 int order[REF_NODES * 4];
5670 ref_stable_order(unsorted, order, cmp);
5671 for (int i = 0; i < sorted->row_count; i++) {
5672 for (int c = 0; c < sorted->col_count; c++) {
5673 if (strcmp(sorted->rows[i][c], unsorted->rows[order[i]][c]) != 0) {
5674 return false;
5675 }
5676 }
5677 }
5678 return true;
5679}
5680
5681static bool ref_query(cbm_store_t *s, const char *query, cbm_cypher_result_t *out) {
5682 memset(out, 0, sizeof(*out));

Callers 1

test_cypher.cFile · 0.85

Calls 1

ref_stable_orderFunction · 0.85

Tested by

no test coverage detected