/ proof-of-concept / cymsimweb
Sign in
proof-of-concept / cymsimweb
cymsimweb / tests / helpers.ts
17 lines · 610 BCodeBlameHistory
2import path from "node:path";
3import { fileURLToPath } from "node:url";
5const here = path.dirname(fileURLToPath(import.meta.url));
6export const fixture = JSON.parse(fs.readFileSync(path.join(here, "fixtures", "python_reference.json"), "utf8"));
8export function maxAbsDiff(a: ArrayLike<number>, b: ArrayLike<number>): number {
9 let m = 0;
10 for (let i = 0; i < a.length; i++) m = Math.max(m, Math.abs(a[i] - b[i]));
11 return m;
13export function maxAbs(a: ArrayLike<number>): number {
14 let m = 0;
15 for (let i = 0; i < a.length; i++) m = Math.max(m, Math.abs(a[i]));
16 return m;
↑↓ move↵openescclose