MCPcopy Create free account
hub / github.com/cortex-js/compute-engine / judge

Function judge

benchmarks/audit/solve.ts:158–175  ·  view source on GitHub ↗
(
  c: Case,
  returned: number,
  sound: number[],
  badReal: number
)

Source from the content-addressed store, hash-verified

156
157/** Grade a Wolfram batch result with the same soundness+completeness oracle as
158 * CE: a returned real root is sound iff |residual| < TOL. */
159function gradeWolfram(c: Case, res: any): { v: Verdict; note?: string } {
160 if (!res || res.status === 'error') return { v: 'error', note: res?.error };
161 if (res.status === 'timeout') return { v: 'error', note: 'timeout' };
162 const roots: any[] = res.roots || [];
163 const mags: any[] = res.values || [];
164 if (res.status !== 'ok' || roots.length === 0)
165 return { v: c.verify.cardinality === 'empty' ? 'correct' : 'unsolved' };
166 const sound: number[] = [];
167 let badReal = 0;
168 for (let i = 0; i < roots.length; i++) {
169 const rv = Number(roots[i]);
170 if (!isFinite(rv)) continue;
171 const m = Number(mags[i]);
172 if (isFinite(m) && m < TOL) sound.push(rv);
173 else badReal++;
174 }
175 return judge(c, roots.length, sound, badReal);
176}
177
178function judge(

Callers 3

runCEFunction · 0.85
runSymPyFunction · 0.85
gradeWolframFunction · 0.85

Calls 2

coversFunction · 0.70
mapMethod · 0.65

Tested by

no test coverage detected