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

Function cx_measure_pair

tests/test_complexity.c:437–463  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

435static char g_cx_root_doubled[512];
436
437static int cx_measure_pair(void) {
438 if (g_cx_measured) {
439 return 0;
440 }
441 const char *tmp = cbm_tmpdir();
442 snprintf(g_cx_root_base, sizeof(g_cx_root_base), "%s/cbm_cx_base_XXXXXX", tmp);
443 snprintf(g_cx_root_doubled, sizeof(g_cx_root_doubled), "%s/cbm_cx_dbl_XXXXXX", tmp);
444 if (!cbm_mkdtemp(g_cx_root_base) || !cbm_mkdtemp(g_cx_root_doubled)) {
445 return -1;
446 }
447 if (cx_build_corpus(g_cx_root_base, CX_K_BASE) != 0 ||
448 cx_build_corpus(g_cx_root_doubled, CX_K_BASE * 2) != 0) {
449 return -1;
450 }
451 char db1[600];
452 char db2[600];
453 snprintf(db1, sizeof(db1), "%s/cx.db", g_cx_root_base);
454 snprintf(db2, sizeof(db2), "%s/cx.db", g_cx_root_doubled);
455 if (cx_run(g_cx_root_base, db1, &g_cx_base) != 0) {
456 return -1;
457 }
458 if (cx_run(g_cx_root_doubled, db2, &g_cx_doubled) != 0) {
459 return -1;
460 }
461 g_cx_measured = true;
462 return 0;
463}
464
465/* ── Tests ───────────────────────────────────────────────────────────── */
466

Callers 1

test_complexity.cFile · 0.85

Calls 4

cbm_tmpdirFunction · 0.85
cbm_mkdtempFunction · 0.85
cx_build_corpusFunction · 0.85
cx_runFunction · 0.85

Tested by

no test coverage detected