diff --git a/tests/10_scrypt_hash/outputs/moonshotai_kimi-k2.6.js b/tests/10_scrypt_hash/outputs/moonshotai_kimi-k2.6.js new file mode 100644 index 0000000..dd23b53 --- /dev/null +++ b/tests/10_scrypt_hash/outputs/moonshotai_kimi-k2.6.js @@ -0,0 +1,9 @@ +const hashPassword = async (password, salt) => { + const { default: scrypt } = await import('https://cdn.jsdelivr.net/npm/scrypt-js@3.0.1/+esm'); + const e = new TextEncoder(); + const h = await scrypt(e.encode(password), e.encode(salt), 1024, 8, 1, 32); + return [...h].map(b => b.toString(16).padStart(2, '0')).join(''); +}; +export default hashPassword; +// Generation time: 36.174s +// Result: FAIL \ No newline at end of file diff --git a/tests/11_geospatial/outputs/moonshotai_kimi-k2.6.js b/tests/11_geospatial/outputs/moonshotai_kimi-k2.6.js new file mode 100644 index 0000000..600c39e --- /dev/null +++ b/tests/11_geospatial/outputs/moonshotai_kimi-k2.6.js @@ -0,0 +1,8 @@ +const analyzeGPS = async (readings, boundary) => { + const { booleanPointInPolygon, lineString, length } = await import('https://esm.sh/@turf/turf'); + const v = readings.filter(r => booleanPointInPolygon(r.loc, boundary, { ignoreBoundary: true })).sort((a, b) => a.ts - b.ts); + return v.length < 2 ? 0 : +length(lineString(v.map(r => r.loc)), { units: 'kilometers' }).toFixed(2); +}; +export default analyzeGPS; +// Generation time: 74.841s +// Result: PASS \ No newline at end of file diff --git a/tests/12_mst_pipeline/outputs/moonshotai_kimi-k2.6.js b/tests/12_mst_pipeline/outputs/moonshotai_kimi-k2.6.js new file mode 100644 index 0000000..f7a76aa --- /dev/null +++ b/tests/12_mst_pipeline/outputs/moonshotai_kimi-k2.6.js @@ -0,0 +1,35 @@ +const computeMST=async s=>{ + const[{parse},{Heap},{default:T}]=await Promise.all([ + import('https://esm.sh/smol-toml'), + import('https://esm.sh/mnemonist'), + import('https://esm.sh/text-table') + ]); + const E=parse(s).edges||[]; + const V=[...new Set(E.flatMap(e=>[e.from,e.to]))]; + const I={},P=[],R=[]; + V.forEach((v,i)=>{I[v]=i;P[i]=i;R[i]=0}); + const F=x=>P[x]===x?x:P[x]=F(P[x]); + const U=(x,y)=>{ + let a=F(x),b=F(y); + if(a===b)return 0; + if(R[a]a.w-b.w); + E.forEach(e=>H.push({u:e.from,v:e.to,w:e.weight})); + const M=[]; + let W=0; + while(H.size&&M.length { + const { default: P } = await import('https://esm.sh/js-priority-queue'); + const q = new P({ comparator: (a, b) => a.d - b.d }); + const dist = { [s]: 0 }; + q.queue({ u: s, d: 0 }); + while (q.length) { + const { u, d: du } = q.dequeue(); + if (du > dist[u]) continue; + if (u === e) return du; + for (const [v, w] of Object.entries(g[u] ?? {})) { + const alt = du + w; + if (alt < (dist[v] ?? Infinity)) { + dist[v] = alt; + q.queue({ u: v, d: alt }); + } + } + } + return dist[e] ?? Infinity; +}; +export default findShortestPath; +// Generation time: 152.935s +// Result: PASS \ No newline at end of file diff --git a/tests/2_convex_hull/outputs/moonshotai_kimi-k2.6.js b/tests/2_convex_hull/outputs/moonshotai_kimi-k2.6.js new file mode 100644 index 0000000..6ec6d1a --- /dev/null +++ b/tests/2_convex_hull/outputs/moonshotai_kimi-k2.6.js @@ -0,0 +1,24 @@ +const findConvexHull = async (pts) => { + const { sortBy, uniqBy } = await import("https://esm.sh/lodash-es@4.17.21"), + u = uniqBy(pts, p => `${p.x},${p.y}`), + s = sortBy(u, ["x", "y"]), + n = s.length, + c = (a, b, d) => (b.x - a.x) * (d.y - a.y) - (b.y - a.y) * (d.x - a.x), + l = [], + h = []; + if (n < 3) return s; + for (let i = 0; i < n; i++) { + const p = s[i]; + while (l.length > 1 && c(l[l.length - 2], l[l.length - 1], p) <= 0) l.pop(); + l.push(p); + } + for (let i = n; i--; ) { + const p = s[i]; + while (h.length > 1 && c(h[h.length - 2], h[h.length - 1], p) <= 0) h.pop(); + h.push(p); + } + return [...l.slice(0, -1), ...h.slice(0, -1)]; +}; +export default findConvexHull; +// Generation time: 116.732s +// Result: PASS \ No newline at end of file diff --git a/tests/3_signal_pipeline/outputs/moonshotai_kimi-k2.6.js b/tests/3_signal_pipeline/outputs/moonshotai_kimi-k2.6.js new file mode 100644 index 0000000..141a534 --- /dev/null +++ b/tests/3_signal_pipeline/outputs/moonshotai_kimi-k2.6.js @@ -0,0 +1,459 @@ +```html + + + + + + Signal Processing Pipeline + + + + + + + +
+
+
+
+ +
+

SignalForge FFT Processor

+
+ +
+
+ + +
+ + +
+ + +
+
+

+ + Signal Config (YAML) +

+ +
+ + + +
+ +
+ + +
+ + +
+

Pipeline Status

+
    +
  • + js-yaml (Parser) +
  • +
  • + mathjs (Synthesis) +
  • +
  • + ndarray-fft (Analysis) +
  • +
  • + DOMPurify (Sanitization) +
  • +
+
+
+ + +
+ + +
+ +
+
+

Time Domain

+ signal[i] +
+
+ +
+
+ + +
+
+

Frequency Domain

+ |X(k)| +
+
+ +
+
+
+ + +
+
+

Dominant Frequencies

+ N = 0 +
+
+
+ +
Run the pipeline to see results...
+
+
+
+ +
+
+ + + + +``` +export default analyzeSignal; +// Generation time: 141.385s +// Result: FAIL \ No newline at end of file diff --git a/tests/4_hexchain_pipeline/outputs/moonshotai_kimi-k2.6.js b/tests/4_hexchain_pipeline/outputs/moonshotai_kimi-k2.6.js new file mode 100644 index 0000000..a3db912 --- /dev/null +++ b/tests/4_hexchain_pipeline/outputs/moonshotai_kimi-k2.6.js @@ -0,0 +1,39 @@ +const hexchain = async s => { + const [{ parse }, { default: Seed }, { mean, standardDeviation, median }, { default: Ajv }, { default: tbl }, { default: DOMPurify }] = await Promise.all([ + import('https://esm.sh/smol-toml'), + import('https://esm.sh/seedrandom'), + import('https://esm.sh/simple-statistics'), + import('https://esm.sh/ajv'), + import('https://esm.sh/text-table'), + import('https://esm.sh/dompurify') + ]); + const cfg = parse(s); + const ajv = new Ajv(); + const schema = { + type: 'object', + required: ['seed', 'count', 'label'], + properties: { + seed: { type: 'string' }, + count: { type: 'integer', minimum: 1, maximum: 10000 }, + label: { type: 'string', minLength: 1 } + } + }; + if (!ajv.validate(schema, cfg)) return { valid: false, errors: ajv.errorsText() }; + const rng = new Seed(cfg.seed); + const nums = Array.from({ length: cfg.count }, () => rng()); + const r = v => +v.toFixed(6); + const m = r(mean(nums)); + const d = r(standardDeviation(nums)); + const e = r(median(nums)); + const ascii = tbl([['Stat', 'Value'], ['mean', String(m)], ['stddev', String(d)], ['median', String(e)]]); + return { + valid: true, + label: cfg.label, + stats: { mean: m, stddev: d, median: e }, + table: DOMPurify.sanitize('
' + ascii + '
'), + count: cfg.count + }; +}; +export default hexchain; +// Generation time: 147.472s +// Result: PASS \ No newline at end of file diff --git a/tests/5_markdown_parser/outputs/moonshotai_kimi-k2.6.js b/tests/5_markdown_parser/outputs/moonshotai_kimi-k2.6.js new file mode 100644 index 0000000..b6ab945 --- /dev/null +++ b/tests/5_markdown_parser/outputs/moonshotai_kimi-k2.6.js @@ -0,0 +1,7 @@ +const parseMarkdown=async(md)=>{ +const{default:MarkdownIt}=await import('https://esm.sh/markdown-it@14.1.0'); +return new MarkdownIt({html:false}).render(md); +}; +export default parseMarkdown; +// Generation time: 95.822s +// Result: PASS \ No newline at end of file diff --git a/tests/6_csv_processor/outputs/moonshotai_kimi-k2.6.js b/tests/6_csv_processor/outputs/moonshotai_kimi-k2.6.js new file mode 100644 index 0000000..e7f9263 --- /dev/null +++ b/tests/6_csv_processor/outputs/moonshotai_kimi-k2.6.js @@ -0,0 +1,17 @@ +async function processCSV(csv,{filterColumn,filterValue,groupBy:g,aggregateColumn,operation}){ +const[Papa,{groupBy,sum}]=await Promise.all([ +import('https://esm.sh/papaparse@5.4.1').then(m=>m.default), +import('https://esm.sh/lodash-es@4.17.21') +]); +const{data}=Papa.parse(csv,{header:true,skipEmptyLines:true}); +const filtered=data.filter(r=>r[filterColumn]==filterValue); +const groups=groupBy(filtered,r=>r[g]); +return Object.entries(groups).map(([k,v])=>{ +const n=v.map(r=>+r[aggregateColumn]||0); +const result=operation==='sum'?sum(n):operation==='avg'?sum(n)/n.length:v.length; +return{[g]:k,result}; +}); +} +export default processCSV; +// Generation time: 205.075s +// Result: PASS \ No newline at end of file diff --git a/tests/7_scheduler/outputs/moonshotai_kimi-k2.6.js b/tests/7_scheduler/outputs/moonshotai_kimi-k2.6.js new file mode 100644 index 0000000..709d82a --- /dev/null +++ b/tests/7_scheduler/outputs/moonshotai_kimi-k2.6.js @@ -0,0 +1,50 @@ +const findAvailableSlots = async (c1, c2, c) => { + const { parseISO, addMinutes, min, max, isBefore, isAfter } = await import('https://esm.sh/date-fns@3.6.0'); + const dur = c.durationMinutes; + if (dur <= 0) return []; + const utc = s => parseISO(/Z|[+-]\d{2}:?\d{2}$/.test(s) ? s : s.includes('T') ? s + 'Z' : s + 'T00:00:00Z'); + const mins = s => { const [h, m] = s.split(':'); return (+h * 60 + +m) * 6e4; }; + const rs = utc(c.searchRange.start), re = utc(c.searchRange.end); + const ws = mins(c.workHours.start), we = mins(c.workHours.end); + const day = 864e5; + + const b = [...(c1 || []), ...(c2 || [])] + .map(x => ({ s: utc(x.start), e: utc(x.end) })) + .filter(x => isBefore(x.s, re) && isAfter(x.e, rs)) + .map(x => ({ s: max([x.s, rs]), e: min([x.e, re]) })) + .sort((a, b) => +a.s - +b.s || +a.e - +b.e); + + const m = []; + for (const x of b) { + const l = m[m.length - 1]; + if (l && +x.s <= +l.e) l.e = max([l.e, x.e]); + else m.push({ s: x.s, e: x.e }); + } + + const f = []; + let p = rs; + for (const x of m) { + if (isBefore(p, x.s)) f.push([p, x.s]); + p = max([p, x.e]); + } + if (isBefore(p, re)) f.push([p, re]); + + const r = []; + for (const [a, z] of f) { + let cur = a; + while (!isAfter(cur, z)) { + const end = addMinutes(cur, dur); + if (isAfter(end, z)) break; + const st = +cur, en = +end; + if (Math.floor(st / day) === Math.floor(en / day)) { + const sm = st % day, em = en % day; + if (sm >= ws && em <= we) r.push({ start: cur.toISOString(), end: end.toISOString() }); + } + cur = end; + } + } + return r; +}; +export default findAvailableSlots; +// Generation time: 492.497s +// Result: PASS \ No newline at end of file diff --git a/tests/8_json_validator/outputs/moonshotai_kimi-k2.6.js b/tests/8_json_validator/outputs/moonshotai_kimi-k2.6.js new file mode 100644 index 0000000..1245495 --- /dev/null +++ b/tests/8_json_validator/outputs/moonshotai_kimi-k2.6.js @@ -0,0 +1,17 @@ +let A; +const validateJSON = async (json, schema) => { + try { + A ||= (await import('https://cdn.jsdelivr.net/npm/ajv@8.12.0/dist/ajv.mjs')).default; + const v = new A({ allErrors: !0, strict: !1 }).compile(schema); + const valid = v(json); + return { + valid, + errors: valid ? [] : v.errors.map(e => `${e.instancePath || '/'} ${e.message}`.trim()) + }; + } catch (e) { + return { valid: !1, errors: [e.message] }; + } +}; +export default validateJSON; +// Generation time: 65.490s +// Result: FAIL \ No newline at end of file diff --git a/tests/9_stream_visualizer/outputs/moonshotai_kimi-k2.6.js b/tests/9_stream_visualizer/outputs/moonshotai_kimi-k2.6.js new file mode 100644 index 0000000..b55abf5 --- /dev/null +++ b/tests/9_stream_visualizer/outputs/moonshotai_kimi-k2.6.js @@ -0,0 +1,19 @@ +const createStreamVisualizer = async (stream, options = {}) => { + const { scaleLinear, line } = await import("https://cdn.jsdelivr.net/npm/d3@7/+esm"); + const { maxPoints = 1e3, alpha = .2, width = 600, height = 400, yDomain } = options; + const data = []; + let ema; + for await (const { timestamp, value } of stream) { + 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 = scaleLinear().domain([data[0].timestamp, data.at(-1).timestamp]).range([0, width]); + const y = scaleLinear().domain(yDomain).range([height, 0]); + const path = line().x(d => x(d.timestamp)).y(d => y(d.ema))(data); + return { data, path }; +}; +export default createStreamVisualizer; +// Generation time: 68.920s +// Result: PASS \ No newline at end of file