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

Function assertParity

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

Source from the content-addressed store, hash-verified

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

Callers 1

Calls 3

tryKernelExtractFunction · 0.90
extractFromSourceFunction · 0.90
canonFunction · 0.70

Tested by

no test coverage detected