diff --git a/tests/10_scrypt_hash/outputs/anthropic_claude-opus-4.7 EFF_medium.js b/tests/10_scrypt_hash/outputs/anthropic_claude-opus-4.7 EFF_medium.js new file mode 100644 index 0000000..86fd51b --- /dev/null +++ b/tests/10_scrypt_hash/outputs/anthropic_claude-opus-4.7 EFF_medium.js @@ -0,0 +1,9 @@ +const hashPassword = async (password, salt) => { + const { scrypt } = await import('https://esm.sh/scrypt-js'); + const enc = new TextEncoder(); + const hash = await scrypt(enc.encode(password), enc.encode(salt), 1024, 8, 1, 32); + return [...hash].map(b => b.toString(16).padStart(2, '0')).join(''); +}; +export default hashPassword; +// Generation time: 2.662s +// Result: PASS \ No newline at end of file diff --git a/tests/11_geospatial/outputs/anthropic_claude-opus-4.7 EFF_medium.js b/tests/11_geospatial/outputs/anthropic_claude-opus-4.7 EFF_medium.js new file mode 100644 index 0000000..695b94c --- /dev/null +++ b/tests/11_geospatial/outputs/anthropic_claude-opus-4.7 EFF_medium.js @@ -0,0 +1,12 @@ +const analyzeGPS = async (readings, boundary) => { + const turf = await import('https://cdn.skypack.dev/@turf/turf'); + const valid = readings + .filter(r => turf.booleanWithin(turf.point(r.loc), boundary)) + .sort((a, b) => a.ts - b.ts); + if (valid.length < 2) return 0; + const line = turf.lineString(valid.map(r => r.loc)); + return Math.round(turf.length(line, { units: 'kilometers' }) * 100) / 100; +}; +export default analyzeGPS; +// Generation time: 3.035s +// Result: PASS \ No newline at end of file diff --git a/tests/12_mst_pipeline/outputs/anthropic_claude-opus-4.7 EFF_medium.js b/tests/12_mst_pipeline/outputs/anthropic_claude-opus-4.7 EFF_medium.js new file mode 100644 index 0000000..8831f03 --- /dev/null +++ b/tests/12_mst_pipeline/outputs/anthropic_claude-opus-4.7 EFF_medium.js @@ -0,0 +1,62 @@ +async function computeMST(tomlString) { + const [{parse}, {default: Heap}, {default: textTable}] = await Promise.all([ + import('https://esm.sh/smol-toml'), + import('https://esm.sh/mnemonist/heap'), + import('https://esm.sh/text-table') + ]); + + const {edges = []} = parse(tomlString); + const heap = new Heap((a, b) => a.weight - b.weight); + const nodes = new Set(); + + for (const e of edges) { + heap.push(e); + nodes.add(e.from); + nodes.add(e.to); + } + + const parent = new Map(), rank = new Map(); + for (const n of nodes) { + parent.set(n, n); + rank.set(n, 0); + } + + const find = x => { + let r = x; + while (parent.get(r) !== r) r = parent.get(r); + while (parent.get(x) !== r) { + const next = parent.get(x); + parent.set(x, r); + x = next; + } + return r; + }; + + const union = (a, b) => { + const ra = find(a), rb = find(b); + if (ra === rb) return false; + const sa = rank.get(ra), sb = rank.get(rb); + if (sa < sb) parent.set(ra, rb); + else if (sa > sb) parent.set(rb, ra); + else { parent.set(rb, ra); rank.set(ra, sa + 1); } + return true; + }; + + const mst = []; + let totalWeight = 0; + const target = nodes.size - 1; + + while (heap.size && mst.length < target) { + const e = heap.pop(); + if (union(e.from, e.to)) { + mst.push([e.from, e.to, String(e.weight)]); + totalWeight += e.weight; + } + } + + const table = textTable([['From', 'To', 'Weight'], ...mst]); + return {table, totalWeight}; +} +export default computeMST; +// Generation time: 7.828s +// Result: PASS \ No newline at end of file diff --git a/tests/1_dijkstra/outputs/anthropic_claude-opus-4.7 EFF_medium.js b/tests/1_dijkstra/outputs/anthropic_claude-opus-4.7 EFF_medium.js new file mode 100644 index 0000000..b82dd50 --- /dev/null +++ b/tests/1_dijkstra/outputs/anthropic_claude-opus-4.7 EFF_medium.js @@ -0,0 +1,24 @@ +async function findShortestPath(graph, start, end) { + const { default: PriorityQueue } = await import('https://esm.sh/js-priority-queue'); + const dist = {}; + for (const n in graph) dist[n] = Infinity; + dist[start] = 0; + const pq = new PriorityQueue({ comparator: (a, b) => a[0] - b[0] }); + pq.queue([0, start]); + while (pq.length) { + const [d, node] = pq.dequeue(); + if (node === end) return d; + if (d > dist[node]) continue; + for (const [next, w] of Object.entries(graph[node] || {})) { + const nd = d + w; + if (nd < (dist[next] ?? Infinity)) { + dist[next] = nd; + pq.queue([nd, next]); + } + } + } + return Infinity; +} +export default findShortestPath; +// Generation time: 4.505s +// Result: PASS \ No newline at end of file diff --git a/tests/2_convex_hull/outputs/anthropic_claude-opus-4.7 EFF_medium.js b/tests/2_convex_hull/outputs/anthropic_claude-opus-4.7 EFF_medium.js new file mode 100644 index 0000000..3cb5b9f --- /dev/null +++ b/tests/2_convex_hull/outputs/anthropic_claude-opus-4.7 EFF_medium.js @@ -0,0 +1,20 @@ +async function findConvexHull(points) { + const _ = (await import('https://cdn.skypack.dev/lodash')).default; + const pts = _.sortBy(_.uniqWith(points, (a, b) => a.x === b.x && a.y === b.y), ['x', 'y']); + if (pts.length < 2) return pts.slice(); + const cross = (O, A, B) => (A.x - O.x) * (B.y - O.y) - (A.y - O.y) * (B.x - O.x); + const build = arr => { + const h = []; + for (const p of arr) { + while (h.length >= 2 && cross(h[h.length - 2], h[h.length - 1], p) <= 0) h.pop(); + h.push(p); + } + return h; + }; + const lower = build(pts); + const upper = build([...pts].reverse()); + return [...lower.slice(0, -1), ...upper.slice(0, -1)]; +} +export default findConvexHull; +// Generation time: 4.186s +// Result: PASS \ No newline at end of file diff --git a/tests/3_signal_pipeline/outputs/anthropic_claude-opus-4.7 EFF_medium.js b/tests/3_signal_pipeline/outputs/anthropic_claude-opus-4.7 EFF_medium.js new file mode 100644 index 0000000..3a73916 --- /dev/null +++ b/tests/3_signal_pipeline/outputs/anthropic_claude-opus-4.7 EFF_medium.js @@ -0,0 +1,46 @@ +async function analyzeSignal(yamlStr) { + const [yaml, math, ndarray, fft, DOMPurify] = (await Promise.all([ + import('https://esm.sh/js-yaml'), + import('https://esm.sh/mathjs'), + import('https://esm.sh/ndarray'), + import('https://esm.sh/ndarray-fft'), + import('https://esm.sh/dompurify') + ])).map(m => m.default ?? m); + + const cfg = yaml.load(yamlStr); + const N = cfg.sampleRate * cfg.duration; + const signal = Array.from({ length: N }, (_, i) => { + const t = i / cfg.sampleRate; + return cfg.components.reduce( + (s, c) => s + c.amplitude * math.sin(2 * math.pi * c.frequency * t), + 0 + ); + }); + + const real = ndarray(new Float64Array(signal), [N]); + const imag = ndarray(new Float64Array(N), [N]); + fft(1, real, imag); + + const half = N / 2; + const peaks = []; + for (let k = 0; k <= half; k++) { + const mag = math.sqrt(real.get(k) ** 2 + imag.get(k) ** 2) / half; + if (mag > 0.1) { + peaks.push({ + frequencyHz: Math.round(k * cfg.sampleRate / N), + magnitude: Math.round(mag * 100) / 100 + }); + } + } + peaks.sort((a, b) => b.magnitude - a.magnitude); + + const rows = peaks.map(p => `
| Frequency (Hz) | Magnitude |
|---|
${tableStr}`);
+
+ return {
+ valid: true,
+ label: config.label,
+ stats: {mean, stddev, median},
+ table: sanitized,
+ count: config.count
+ };
+};
+export default hexchain;
+// Generation time: 8.530s
+// Result: PASS
\ No newline at end of file
diff --git a/tests/5_markdown_parser/outputs/anthropic_claude-opus-4.7 EFF_medium.js b/tests/5_markdown_parser/outputs/anthropic_claude-opus-4.7 EFF_medium.js
new file mode 100644
index 0000000..46fd8eb
--- /dev/null
+++ b/tests/5_markdown_parser/outputs/anthropic_claude-opus-4.7 EFF_medium.js
@@ -0,0 +1,7 @@
+const parseMarkdown = async md => {
+ const { marked } = await import('https://cdn.jsdelivr.net/npm/marked/+esm');
+ return marked.parse(md);
+};
+export default parseMarkdown;
+// Generation time: 1.391s
+// Result: PASS
\ No newline at end of file
diff --git a/tests/6_csv_processor/outputs/anthropic_claude-opus-4.7 EFF_medium.js b/tests/6_csv_processor/outputs/anthropic_claude-opus-4.7 EFF_medium.js
new file mode 100644
index 0000000..c6e985f
--- /dev/null
+++ b/tests/6_csv_processor/outputs/anthropic_claude-opus-4.7 EFF_medium.js
@@ -0,0 +1,23 @@
+async function processCSV(csv, { filterColumn, filterValue, groupBy, aggregateColumn, operation }) {
+ const { default: Papa } = await import('https://esm.sh/papaparse@5.4.1');
+ const { data } = Papa.parse(csv, { header: true, skipEmptyLines: true });
+ const groups = {};
+ for (const row of data) {
+ if (row[filterColumn] != filterValue) continue;
+ const key = row[groupBy];
+ const n = Number(row[aggregateColumn]);
+ const val = Number.isFinite(n) ? n : 0;
+ (groups[key] ??= { sum: 0, count: 0 });
+ groups[key].sum += val;
+ groups[key].count++;
+ }
+ const calc = {
+ sum: g => g.sum,
+ avg: g => g.sum / g.count,
+ count: g => g.count,
+ }[operation];
+ return Object.entries(groups).map(([k, g]) => ({ [groupBy]: k, result: calc(g) }));
+}
+export default processCSV;
+// Generation time: 5.004s
+// Result: PASS
\ No newline at end of file
diff --git a/tests/7_scheduler/outputs/anthropic_claude-opus-4.7 EFF_medium.js b/tests/7_scheduler/outputs/anthropic_claude-opus-4.7 EFF_medium.js
new file mode 100644
index 0000000..0f4600e
--- /dev/null
+++ b/tests/7_scheduler/outputs/anthropic_claude-opus-4.7 EFF_medium.js
@@ -0,0 +1,52 @@
+async function findAvailableSlots(cal1, cal2, { durationMinutes, searchRange, workHours }) {
+ const { parseISO, addMinutes } = await import('https://cdn.skypack.dev/date-fns');
+ const ms = s => parseISO(s).getTime();
+ const iso = t => new Date(t).toISOString();
+ const parseHM = t => {
+ const [h, m] = t.split(':').map(Number);
+ return (h * 60 + m) * 60000;
+ };
+
+ const rs = ms(searchRange.start);
+ const re = ms(searchRange.end);
+ const durMs = durationMinutes * 60000;
+ const whS = parseHM(workHours.start);
+ const whE = parseHM(workHours.end);
+ const DAY = 86400000;
+
+ const merged = [...cal1, ...cal2]
+ .map(b => [ms(b.start), ms(b.end)])
+ .filter(([s, e]) => e > rs && s < re)
+ .map(([s, e]) => [Math.max(s, rs), Math.min(e, re)])
+ .sort((a, b) => a[0] - b[0])
+ .reduce((acc, [s, e]) => {
+ const last = acc.at(-1);
+ if (last && s <= last[1]) last[1] = Math.max(last[1], e);
+ else acc.push([s, e]);
+ return acc;
+ }, []);
+
+ const free = [];
+ let cur = rs;
+ for (const [s, e] of merged) {
+ if (s > cur) free.push([cur, s]);
+ cur = Math.max(cur, e);
+ }
+ if (cur < re) free.push([cur, re]);
+
+ const slots = [];
+ for (const [fs, fe] of free) {
+ for (let day = Math.floor(fs / DAY) * DAY; day < fe; day += DAY) {
+ const s = Math.max(fs, day + whS);
+ const e = Math.min(fe, day + whE);
+ for (let t = s; t + durMs <= e; t = addMinutes(new Date(t), durationMinutes).getTime()) {
+ slots.push({ start: iso(t), end: iso(t + durMs) });
+ }
+ }
+ }
+
+ return slots;
+}
+export default findAvailableSlots;
+// Generation time: 28.829s
+// Result: PASS
\ No newline at end of file
diff --git a/tests/8_json_validator/outputs/anthropic_claude-opus-4.7 EFF_medium.js b/tests/8_json_validator/outputs/anthropic_claude-opus-4.7 EFF_medium.js
new file mode 100644
index 0000000..fc4443d
--- /dev/null
+++ b/tests/8_json_validator/outputs/anthropic_claude-opus-4.7 EFF_medium.js
@@ -0,0 +1,13 @@
+const validateJSON = async (data, schema) => {
+ const { default: Ajv } = await import('https://cdn.jsdelivr.net/npm/ajv@8/+esm');
+ const ajv = new Ajv({ allErrors: true, strict: false });
+ const validate = ajv.compile(schema);
+ const valid = validate(data);
+ return {
+ valid,
+ errors: valid ? [] : validate.errors.map(e => `${e.instancePath || '/'} ${e.message}`)
+ };
+};
+export default validateJSON;
+// Generation time: 2.748s
+// Result: PASS
\ No newline at end of file
diff --git a/tests/9_stream_visualizer/outputs/anthropic_claude-opus-4.7 EFF_medium.js b/tests/9_stream_visualizer/outputs/anthropic_claude-opus-4.7 EFF_medium.js
new file mode 100644
index 0000000..8ebf47e
--- /dev/null
+++ b/tests/9_stream_visualizer/outputs/anthropic_claude-opus-4.7 EFF_medium.js
@@ -0,0 +1,31 @@
+async function createStreamVisualizer(asyncIterable, options) {
+ const { maxPoints, alpha, width, height, yDomain } = options;
+ const d3 = await import("https://cdn.jsdelivr.net/npm/d3@7/+esm");
+ const data = [];
+ let ema;
+
+ for await (const { timestamp, value } of asyncIterable) {
+ ema = data.length ? alpha * value + (1 - alpha) * ema : value;
+ data.push({ timestamp, value, ema });
+ if (data.length > maxPoints) data.shift();
+ }
+
+ if (!data.length) return { data, path: "" };
+
+ const x = d3.scaleLinear()
+ .domain([data[0].timestamp, data[data.length - 1].timestamp])
+ .range([0, width]);
+
+ const y = d3.scaleLinear()
+ .domain(yDomain)
+ .range([height, 0]);
+
+ const path = d3.line()
+ .x(d => x(d.timestamp))
+ .y(d => y(d.ema))(data) ?? "";
+
+ return { data, path };
+}
+export default createStreamVisualizer;
+// Generation time: 6.848s
+// Result: PASS
\ No newline at end of file