MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / assertParity

Function assertParity

__tests__/kernel-php-parity.test.ts:87–103  ·  view source on GitHub ↗
(filePath: string, source: string, minNodes = 3)

Source from the content-addressed store, hash-verified

85 });
86
87 function assertParity(filePath: string, source: string, minNodes = 3): void {
88 process.env.CODEGRAPH_KERNEL_LANGS = 'all';
89 delete process.env.CODEGRAPH_KERNEL;
90 const viaKernel = tryKernelExtract(filePath, source, 'php');
91 expect(viaKernel, `kernel extraction failed for ${filePath}`).not.toBeNull();
92
93 process.env.CODEGRAPH_KERNEL = '0';
94 const viaWasm = extractFromSource(filePath, source, 'php');
95 delete process.env.CODEGRAPH_KERNEL;
96
97 const k = canon(viaKernel!);
98 const w = canon(viaWasm);
99 expect(k.nodes, `${filePath}: nodes`).toEqual(w.nodes);
100 expect(k.edges, `${filePath}: edges`).toEqual(w.edges);
101 expect(k.refs, `${filePath}: refs`).toEqual(w.refs);
102 expect(viaWasm.nodes.length).toBeGreaterThanOrEqual(minNodes);
103 }
104
105 const FIXTURES: Array<{ file: string; minNodes: number }> = [
106 { file: 'torture.php', minNodes: 45 },

Callers 1

Calls 3

tryKernelExtractFunction · 0.90
extractFromSourceFunction · 0.90
canonFunction · 0.70

Tested by

no test coverage detected