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

Function assertParity

__tests__/kernel-lua-parity.test.ts:84–106  ·  view source on GitHub ↗
(
    filePath: string,
    source: string,
    lang: Language,
    minNodes = 3
  )

Source from the content-addressed store, hash-verified

82 });
83
84 function assertParity(
85 filePath: string,
86 source: string,
87 lang: Language,
88 minNodes = 3
89 ): ExtractionResult {
90 process.env.CODEGRAPH_KERNEL_LANGS = 'all';
91 delete process.env.CODEGRAPH_KERNEL;
92 const viaKernel = tryKernelExtract(filePath, source, lang);
93 expect(viaKernel, `kernel extraction failed for ${filePath}`).not.toBeNull();
94
95 process.env.CODEGRAPH_KERNEL = '0';
96 const viaWasm = extractFromSource(filePath, source, lang);
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 return viaKernel!;
106 }
107
108 it('torture.lua: requires, receiver QNs, visibility inversion, callee zoo, fn-refs', () => {
109 const file = path.join(FIXTURE_DIR, 'torture.lua');

Callers 1

Calls 3

tryKernelExtractFunction · 0.90
extractFromSourceFunction · 0.90
canonFunction · 0.70

Tested by

no test coverage detected