diff --git a/tests/10_scrypt_hash/outputs/google_gemini-3.8-flash EFF_high.js b/tests/10_scrypt_hash/outputs/google_gemini-3.8-flash EFF_high.js new file mode 100644 index 0000000..6f2844b --- /dev/null +++ b/tests/10_scrypt_hash/outputs/google_gemini-3.8-flash EFF_high.js @@ -0,0 +1,18 @@ +export async function hashPassword(password, salt) { + const { scrypt } = await import('https://esm.sh/scrypt-js@3.0.1'); + const enc = new TextEncoder(); + + const hash = await scrypt( + enc.encode(password), + enc.encode(salt), + 1024, + 8, + 1, + 32 + ); + + return Array.from(hash, (b) => b.toString(16).padStart(2, '0')).join(''); +} +export default hashPassword; +// Generation time: 13.651s +// Result: PASS \ No newline at end of file diff --git a/tests/11_geospatial/outputs/google_gemini-3.8-flash EFF_high.js b/tests/11_geospatial/outputs/google_gemini-3.8-flash EFF_high.js new file mode 100644 index 0000000..79db551 --- /dev/null +++ b/tests/11_geospatial/outputs/google_gemini-3.8-flash EFF_high.js @@ -0,0 +1,15 @@ +export async function analyzeGPS(readings, boundary) { + const turf = await import('https://esm.sh/@turf/turf'); + + const pts = readings + .filter(r => turf.booleanPointInPolygon(r.loc, boundary, { ignoreBoundary: true })) + .sort((a, b) => a.ts - b.ts) + .map(r => r.loc); + + return pts.length < 2 + ? 0 + : +turf.length(turf.lineString(pts), { units: 'kilometers' }).toFixed(2); +} +export default analyzeGPS; +// Generation time: 24.485s +// Result: PASS \ No newline at end of file diff --git a/tests/12_mst_pipeline/outputs/google_gemini-3.8-flash EFF_high.js b/tests/12_mst_pipeline/outputs/google_gemini-3.8-flash EFF_high.js new file mode 100644 index 0000000..4357dcf --- /dev/null +++ b/tests/12_mst_pipeline/outputs/google_gemini-3.8-flash EFF_high.js @@ -0,0 +1,70 @@ +class UnionFind { + p = new Map(); + r = new Map(); + + constructor(elements) { + for (const el of elements) { + this.p.set(el, el); + this.r.set(el, 0); + } + } + + find(i) { + if (this.p.get(i) !== i) this.p.set(i, this.find(this.p.get(i))); + return this.p.get(i); + } + + union(i, j) { + let [rootI, rootJ] = [this.find(i), this.find(j)]; + if (rootI === rootJ) return false; + + const [rankI, rankJ] = [this.r.get(rootI), this.r.get(rootJ)]; + if (rankI < rankJ) [rootI, rootJ] = [rootJ, rootI]; + this.p.set(rootJ, rootI); + if (rankI === rankJ) this.r.set(rootI, rankI + 1); + + return true; + } +} + +export async function computeMST(tomlStr) { + const [{ parse }, mnemonist, textTableMod] = await Promise.all([ + import('https://esm.sh/smol-toml'), + import('https://esm.sh/mnemonist'), + import('https://esm.sh/text-table') + ]); + + const Heap = mnemonist.Heap || mnemonist.default?.Heap; + const table = textTableMod.default || textTableMod; + + const { edges = [] } = parse(tomlStr); + const nodes = new Set(); + const heap = new Heap((a, b) => Number(a.weight) - Number(b.weight)); + + for (const edge of edges) { + nodes.add(edge.from); + nodes.add(edge.to); + heap.push(edge); + } + + const uf = new UnionFind(nodes); + const mst = []; + let totalWeight = 0; + const targetEdges = Math.max(0, nodes.size - 1); + + while (mst.length < targetEdges && heap.size > 0) { + const edge = heap.pop(); + if (uf.union(edge.from, edge.to)) { + mst.push([edge.from, edge.to, String(edge.weight)]); + totalWeight += Number(edge.weight); + } + } + + return { + table: table([['From', 'To', 'Weight'], ...mst]), + totalWeight + }; +} +export default computeMST; +// Generation time: 31.116s +// Result: PASS \ No newline at end of file diff --git a/tests/1_dijkstra/outputs/google_gemini-3.8-flash EFF_high.js b/tests/1_dijkstra/outputs/google_gemini-3.8-flash EFF_high.js new file mode 100644 index 0000000..f714087 --- /dev/null +++ b/tests/1_dijkstra/outputs/google_gemini-3.8-flash EFF_high.js @@ -0,0 +1,27 @@ +export async function findShortestPath(graph, start, end) { + const { default: PriorityQueue } = await import('https://esm.sh/js-priority-queue'); + + const dist = new Map([[start, 0]]); + const pq = new PriorityQueue({ comparator: (a, b) => a[1] - b[1] }); + pq.queue([start, 0]); + + while (pq.length) { + const [node, cost] = pq.dequeue(); + + if (node === end) return cost; + if (cost > (dist.get(node) ?? Infinity)) continue; + + for (const [neighbor, weight] of Object.entries(graph[node] ?? {})) { + const nextCost = cost + weight; + if (nextCost < (dist.get(neighbor) ?? Infinity)) { + dist.set(neighbor, nextCost); + pq.queue([neighbor, nextCost]); + } + } + } + + return Infinity; +} +export default findShortestPath; +// Generation time: 16.431s +// Result: PASS \ No newline at end of file diff --git a/tests/2_convex_hull/outputs/google_gemini-3.8-flash EFF_high.js b/tests/2_convex_hull/outputs/google_gemini-3.8-flash EFF_high.js new file mode 100644 index 0000000..4bc2c1c --- /dev/null +++ b/tests/2_convex_hull/outputs/google_gemini-3.8-flash EFF_high.js @@ -0,0 +1,23 @@ +export async function findConvexHull(points) { + const { sortBy, uniqWith, isEqual } = await import('https://cdn.jsdelivr.net/npm/lodash-es/+esm'); + + const pts = sortBy(uniqWith(points, isEqual), ['x', 'y']); + if (pts.length <= 2) return pts; + + const cross = (o, a, b) => (a.x - o.x) * (b.y - o.y) - (a.y - o.y) * (b.x - o.x); + + const buildHull = (pList) => pList.reduce((hull, p) => { + while (hull.length >= 2 && cross(hull[hull.length - 2], hull[hull.length - 1], p) <= 0) { + hull.pop(); + } + return hull.push(p), hull; + }, []); + + const lower = buildHull(pts); + const upper = buildHull([...pts].reverse()); + + return lower.slice(0, -1).concat(upper.slice(0, -1)); +} +export default findConvexHull; +// Generation time: 25.877s +// Result: PASS \ No newline at end of file diff --git a/tests/3_signal_pipeline/outputs/google_gemini-3.8-flash EFF_high.js b/tests/3_signal_pipeline/outputs/google_gemini-3.8-flash EFF_high.js new file mode 100644 index 0000000..021931c --- /dev/null +++ b/tests/3_signal_pipeline/outputs/google_gemini-3.8-flash EFF_high.js @@ -0,0 +1,49 @@ +export async function analyzeSignal(yamlString) { + 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 { sampleRate, duration, components } = yaml.load(yamlString); + const N = sampleRate * duration; + const halfN = N / 2; + + const signal = Float64Array.from({ length: N }, (_, i) => { + const t = i / sampleRate; + return components.reduce( + (sum, { frequency, amplitude }) => sum + amplitude * math.sin(2 * math.pi * frequency * t), + 0 + ); + }); + + const real = ndarray(signal, [N]); + const imag = ndarray(new Float64Array(N), [N]); + fft(1, real, imag); + + const peaks = []; + for (let k = 0; k <= halfN; k++) { + const magnitude = math.sqrt(real.get(k) ** 2 + imag.get(k) ** 2) / halfN; + if (magnitude > 0.1) { + peaks.push({ frequencyHz: (k * sampleRate) / N, magnitude }); + } + } + + peaks.sort((a, b) => b.magnitude - a.magnitude); + for (const p of peaks) { + p.frequencyHz = Math.round(p.frequencyHz); + p.magnitude = +p.magnitude.toFixed(2); + } + + const rows = peaks.map(p => `
| Frequency (Hz) | Magnitude |
|---|
${tableStr}`);
+
+ return {
+ valid: true,
+ label: config.label,
+ stats: { mean, stddev, median },
+ table,
+ count: config.count
+ };
+}
+export default hexchain;
+// Generation time: 57.013s
+// Result: PASS
\ No newline at end of file
diff --git a/tests/5_markdown_parser/outputs/google_gemini-3.8-flash EFF_high.js b/tests/5_markdown_parser/outputs/google_gemini-3.8-flash EFF_high.js
new file mode 100644
index 0000000..e830f18
--- /dev/null
+++ b/tests/5_markdown_parser/outputs/google_gemini-3.8-flash EFF_high.js
@@ -0,0 +1,10 @@
+let lib;
+
+export async function parseMarkdown(text = '') {
+ lib ??= import('https://esm.sh/marked');
+ const { marked } = await lib;
+ return marked.parse(String(text));
+}
+export default parseMarkdown;
+// Generation time: 15.759s
+// Result: PASS
\ No newline at end of file
diff --git a/tests/6_csv_processor/outputs/google_gemini-3.8-flash EFF_high.js b/tests/6_csv_processor/outputs/google_gemini-3.8-flash EFF_high.js
new file mode 100644
index 0000000..45cf70f
--- /dev/null
+++ b/tests/6_csv_processor/outputs/google_gemini-3.8-flash EFF_high.js
@@ -0,0 +1,23 @@
+export async function processCSV(csvString, { filterColumn, filterValue, groupBy, aggregateColumn, operation }) {
+ const Papa = (await import('https://cdn.jsdelivr.net/npm/papaparse@5.4.1/+esm')).default;
+ const { data } = Papa.parse(csvString, { header: true, skipEmptyLines: true });
+
+ const groups = new Map();
+ for (const row of data) {
+ if (row[filterColumn] == filterValue) {
+ const key = row[groupBy];
+ const entry = groups.get(key) || { sum: 0, count: 0 };
+ entry.sum += Number(row[aggregateColumn]) || 0;
+ entry.count++;
+ groups.set(key, entry);
+ }
+ }
+
+ return Array.from(groups, ([key, { sum, count }]) => ({
+ [groupBy]: key,
+ result: operation === 'count' ? count : operation === 'avg' ? sum / count : sum
+ }));
+}
+export default processCSV;
+// Generation time: 82.511s
+// Result: PASS
\ No newline at end of file
diff --git a/tests/7_scheduler/outputs/google_gemini-3.8-flash EFF_high.js b/tests/7_scheduler/outputs/google_gemini-3.8-flash EFF_high.js
new file mode 100644
index 0000000..f10fc56
--- /dev/null
+++ b/tests/7_scheduler/outputs/google_gemini-3.8-flash EFF_high.js
@@ -0,0 +1,56 @@
+export async function findAvailableSlots(cal1, cal2, constraints) {
+ const { DateTime } = await import('https://cdn.jsdelivr.net/npm/luxon@3/+esm');
+ const { durationMinutes, searchRange, workHours } = constraints;
+ const dur = durationMinutes * 60000;
+ const toUtc = s => DateTime.fromISO(s, { zone: 'utc' });
+ const [sH, sM] = workHours.start.split(':').map(Number);
+ const [eH, eM] = workHours.end.split(':').map(Number);
+
+ const rangeStart = toUtc(searchRange.start);
+ const rangeEnd = toUtc(searchRange.end);
+ const rStartMs = rangeStart.toMillis();
+ const rEndMs = rangeEnd.toMillis();
+
+ const busy = [...cal1, ...cal2]
+ .map(({ start, end }) => ({ s: toUtc(start).toMillis(), e: toUtc(end).toMillis() }))
+ .filter(b => b.s < b.e)
+ .sort((a, b) => a.s - b.s);
+
+ const mergedBusy = busy.reduce((acc, b) => {
+ const last = acc[acc.length - 1];
+ last && b.s <= last.e ? (last.e = Math.max(last.e, b.e)) : acc.push({ ...b });
+ return acc;
+ }, []);
+
+ const slots = [];
+ const addSlots = (from, to) => {
+ for (let t = from; t + dur <= to; t += dur) {
+ slots.push({
+ start: DateTime.fromMillis(t, { zone: 'utc' }).toISO(),
+ end: DateTime.fromMillis(t + dur, { zone: 'utc' }).toISO()
+ });
+ }
+ };
+
+ for (let d = rangeStart.startOf('day'); d <= rangeEnd; d = d.plus({ days: 1 })) {
+ const wStart = Math.max(d.set({ hour: sH, minute: sM, second: 0, millisecond: 0 }).toMillis(), rStartMs);
+ const wEnd = Math.min(d.set({ hour: eH, minute: eM, second: 0, millisecond: 0 }).toMillis(), rEndMs);
+
+ if (wStart < wEnd) {
+ let cur = wStart;
+ for (const b of mergedBusy) {
+ if (b.e <= cur) continue;
+ if (b.s >= wEnd) break;
+ if (b.s > cur) addSlots(cur, Math.min(b.s, wEnd));
+ cur = Math.max(cur, b.e);
+ if (cur >= wEnd) break;
+ }
+ if (cur < wEnd) addSlots(cur, wEnd);
+ }
+ }
+
+ return slots;
+}
+export default findAvailableSlots;
+// Generation time: 71.113s
+// Result: PASS
\ No newline at end of file
diff --git a/tests/8_json_validator/outputs/google_gemini-3.8-flash EFF_high.js b/tests/8_json_validator/outputs/google_gemini-3.8-flash EFF_high.js
new file mode 100644
index 0000000..392a5bf
--- /dev/null
+++ b/tests/8_json_validator/outputs/google_gemini-3.8-flash EFF_high.js
@@ -0,0 +1,20 @@
+export async function validateJSON(data, schema) {
+ try {
+ const { default: Ajv } = await import('https://esm.sh/ajv@8');
+ const validate = new Ajv({ allErrors: true, strict: false }).compile(schema);
+ const valid = !!validate(data);
+
+ return {
+ valid,
+ errors: valid ? [] : validate.errors.map(e => e.instancePath ? `${e.instancePath} ${e.message}` : e.message)
+ };
+ } catch (err) {
+ return {
+ valid: false,
+ errors: [err.message]
+ };
+ }
+}
+export default validateJSON;
+// Generation time: 22.203s
+// Result: PASS
\ No newline at end of file
diff --git a/tests/9_stream_visualizer/outputs/google_gemini-3.8-flash EFF_high.js b/tests/9_stream_visualizer/outputs/google_gemini-3.8-flash EFF_high.js
new file mode 100644
index 0000000..c3024e0
--- /dev/null
+++ b/tests/9_stream_visualizer/outputs/google_gemini-3.8-flash EFF_high.js
@@ -0,0 +1,34 @@
+export async function createStreamVisualizer(asyncIterable, { maxPoints, alpha, width, height, yDomain }) {
+ const [d3, data] = await Promise.all([
+ import('d3'),
+ (async () => {
+ const buffer = [];
+ let ema;
+ for await (const { timestamp, value } of asyncIterable) {
+ ema = ema == null ? value : alpha * value + (1 - alpha) * ema;
+ buffer.push({ timestamp, value, ema });
+ if (buffer.length > maxPoints) buffer.shift();
+ }
+ return buffer;
+ })()
+ ]);
+
+ if (!data.length) return { data, path: '' };
+
+ const x = d3.scaleLinear()
+ .domain([data[0].timestamp, data.at(-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: 21.189s
+// Result: FAIL
\ No newline at end of file