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

Function assertParity

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

Source from the content-addressed store, hash-verified

81 });
82
83 function assertParity(filePath: string, source: string, minNodes = 3): void {
84 process.env.CODEGRAPH_KERNEL_LANGS = 'all';
85 delete process.env.CODEGRAPH_KERNEL;
86 const viaKernel = tryKernelExtract(filePath, source, 'swift');
87 expect(viaKernel, `kernel extraction failed for ${filePath}`).not.toBeNull();
88
89 process.env.CODEGRAPH_KERNEL = '0';
90 const viaWasm = extractFromSource(filePath, source, 'swift');
91 delete process.env.CODEGRAPH_KERNEL;
92
93 const k = canon(viaKernel!);
94 const w = canon(viaWasm);
95 expect(k.nodes, `${filePath}: nodes`).toEqual(w.nodes);
96 expect(k.edges, `${filePath}: edges`).toEqual(w.edges);
97 expect(k.refs, `${filePath}: refs`).toEqual(w.refs);
98 expect(viaWasm.nodes.length).toBeGreaterThanOrEqual(minNodes);
99 }
100
101 it('torture fixture: property branch, extensions, call matrix, value refs, fn-refs', () => {
102 const file = path.join(FIXTURE_DIR, 'torture.swift');

Callers 1

Calls 3

tryKernelExtractFunction · 0.90
extractFromSourceFunction · 0.90
canonFunction · 0.70

Tested by

no test coverage detected