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

Function assertParity

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

Source from the content-addressed store, hash-verified

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

Callers 1

Calls 3

tryKernelExtractFunction · 0.90
extractFromSourceFunction · 0.90
canonFunction · 0.70

Tested by

no test coverage detected