diff --git a/results.json b/results.json index 5dfd95f..ad0162a 100644 --- a/results.json +++ b/results.json @@ -76,5 +76,161 @@ "7_scheduler": 68.04158863600017, "8_json_validator": 19.484740249000023, "9_stream_visualizer": 28.426358369000255 + }, + "gemini-3-pro-preview TEMP:1.1": { + "10_scrypt_hash": 19.25561597, + "11_geospatial": 16.537793451, + "1_dijkstra": 19.709102094000002, + "2_convex_hull": 23.759404848, + "3_lis": 23.048148686, + "4_determinant": 20.935209288, + "5_markdown_parser": 34.398462477999985, + "6_csv_processor": 43.183913065, + "7_scheduler": 31.16975645300001, + "8_json_validator": 22.189696912000013, + "9_stream_visualizer": 27.786803166999977 + }, + "gemini-3-pro-preview TEMP:1": { + "10_scrypt_hash": 16.73660885900003, + "11_geospatial": 27.702141619000002, + "1_dijkstra": 24.343912240999984, + "2_convex_hull": 22.499538950000016, + "3_lis": 23.92277027799998, + "4_determinant": 19.12632760900003, + "5_markdown_parser": 24.235546227000015, + "6_csv_processor": 28.255928477999987, + "7_scheduler": 52.90334799400001, + "8_json_validator": 16.544846496000012, + "9_stream_visualizer": 28.031947036999977 + }, + "gemini-3-pro-preview TEMP:0.9": { + "10_scrypt_hash": 18.39214110999997, + "11_geospatial": 21.698826697999962, + "1_dijkstra": 31.32494983399997, + "2_convex_hull": 33.63882225600001, + "3_lis": 22.98625518599991, + "4_determinant": 9.706784340000013, + "5_markdown_parser": 25.077740615000017, + "6_csv_processor": 38.424850744000054, + "7_scheduler": 40.46733092999994, + "8_json_validator": 21.866049754999928, + "9_stream_visualizer": 29.938616987999993 + }, + "gemini-3-pro-preview TEMP:0.8": { + "10_scrypt_hash": 22.864061476000003, + "11_geospatial": 21.802520365000003, + "1_dijkstra": 25.727360443000098, + "2_convex_hull": 20.067116691999953, + "3_lis": 17.514798727000016, + "4_determinant": 26.222232214999966, + "5_markdown_parser": 27.822983316000084, + "6_csv_processor": 31.795846373000067, + "7_scheduler": 45.54547771500005, + "8_json_validator": 20.04490028099995, + "9_stream_visualizer": 31.52293631999986 + }, + "gemini-3-pro-preview TEMP:0.7": { + "10_scrypt_hash": 23.39639778, + "11_geospatial": 23.114445250999882, + "1_dijkstra": 24.20112610200001, + "2_convex_hull": 29.664885391999967, + "3_lis": 15.16884128500009, + "4_determinant": 36.34684787500021, + "5_markdown_parser": 27.07226724700001, + "6_csv_processor": 36.69383957000007, + "7_scheduler": 41.66182964499993, + "8_json_validator": 24.68038384200004, + "9_stream_visualizer": 32.811990770999806 + }, + "gemini-3-pro-preview TEMP:0.6": { + "10_scrypt_hash": 20.319240230000112, + "11_geospatial": 14.71396687299991, + "1_dijkstra": 29.94397802599985, + "2_convex_hull": 30.130152880999958, + "3_lis": 22.789678306000074, + "4_determinant": 13.336225186000112, + "5_markdown_parser": 26.61024377000006, + "6_csv_processor": 23.28925823200005, + "7_scheduler": 31.414080646000105, + "8_json_validator": 18.36662647700007, + "9_stream_visualizer": 31.141520149999998 + }, + "gemini-3-pro-preview TEMP:0.5": { + "10_scrypt_hash": 26.257502701000078, + "11_geospatial": 27.292514397000197, + "1_dijkstra": 26.930725388999797, + "2_convex_hull": 28.365386472000043, + "3_lis": 20.404020288000115, + "4_determinant": 19.956521905999864, + "5_markdown_parser": 41.075851207999975, + "6_csv_processor": 33.550666006000014, + "7_scheduler": 54.52258278499986, + "8_json_validator": 30.504760077999904, + "9_stream_visualizer": 25.344985834000166 + }, + "gemini-3-pro-preview TEMP:0.4": { + "10_scrypt_hash": 16.79715236100019, + "11_geospatial": 25.48661641700007, + "1_dijkstra": 17.67472643599985, + "2_convex_hull": 34.115073089000305, + "3_lis": 18.289524143000133, + "4_determinant": 22.224696940999944, + "5_markdown_parser": 53.21322759300005, + "6_csv_processor": 39.43421280799993, + "7_scheduler": 30.78163343900023, + "8_json_validator": 26.184069054999853, + "9_stream_visualizer": 21.324422691999935 + }, + "gemini-3-pro-preview TEMP:0.3": { + "10_scrypt_hash": 22.419933818999677, + "11_geospatial": 14.525312852999662, + "1_dijkstra": 24.24144133199984, + "2_convex_hull": 27.67347379200021, + "3_lis": 13.649138154000044, + "4_determinant": 28.68561609600019, + "5_markdown_parser": 44.175827321999705, + "6_csv_processor": 40.22086091799987, + "7_scheduler": 42.102860941999595, + "8_json_validator": 24.13780150000006, + "9_stream_visualizer": 22.134434574999847 + }, + "gemini-3-pro-preview TEMP:0.2": { + "10_scrypt_hash": 24.400115432000252, + "11_geospatial": 32.89142006099969, + "1_dijkstra": 36.531734934999605, + "2_convex_hull": 30.47034405499976, + "3_lis": 14.03327947399998, + "4_determinant": 15.886417729000096, + "5_markdown_parser": 43.89735358300013, + "6_csv_processor": 36.24166352199996, + "7_scheduler": 49.958096608999654, + "8_json_validator": 21.518541840999852, + "9_stream_visualizer": 30.054751582999714 + }, + "gemini-3-pro-preview TEMP:0.1": { + "10_scrypt_hash": 21.251296984999907, + "11_geospatial": 28.01666565400036, + "1_dijkstra": 22.908056412999983, + "2_convex_hull": 31.488867672999856, + "3_lis": 19.367484238999896, + "4_determinant": 16.061534822999967, + "5_markdown_parser": 30.51042381200008, + "6_csv_processor": 20.860845792999957, + "7_scheduler": 34.17653273200011, + "8_json_validator": 14.083612348000054, + "9_stream_visualizer": 19.854906946000177 + }, + "gemini-3-pro-preview TEMP:0": { + "10_scrypt_hash": 22.467800446999725, + "11_geospatial": 23.184671450000256, + "1_dijkstra": 28.33117579400027, + "2_convex_hull": 26.517016473000403, + "3_lis": 17.292057299999986, + "4_determinant": 22.012527137000113, + "5_markdown_parser": 44.51245308799995, + "6_csv_processor": 35.65954501500027, + "7_scheduler": 31.53722489799978, + "8_json_validator": 21.652465214000085, + "9_stream_visualizer": 28.28463803699985 } } \ No newline at end of file diff --git a/tests/10_scrypt_hash/outputs_gemini/gemini-3-pro-preview TEMP_0.1.js b/tests/10_scrypt_hash/outputs_gemini/gemini-3-pro-preview TEMP_0.1.js new file mode 100644 index 0000000..dbb359c --- /dev/null +++ b/tests/10_scrypt_hash/outputs_gemini/gemini-3-pro-preview TEMP_0.1.js @@ -0,0 +1,7 @@ +const hashPassword = async (p, s) => { + const { scrypt } = await import('https://esm.sh/scrypt-js@3.0.1') + const e = new TextEncoder() + const k = await scrypt(e.encode(p), e.encode(s), 1024, 8, 1, 32) + return [...k].map(b => (b + 256).toString(16).slice(1)).join('') +} +export default hashPassword; \ No newline at end of file diff --git a/tests/10_scrypt_hash/outputs_gemini/gemini-3-pro-preview TEMP_0.2.js b/tests/10_scrypt_hash/outputs_gemini/gemini-3-pro-preview TEMP_0.2.js new file mode 100644 index 0000000..d98f403 --- /dev/null +++ b/tests/10_scrypt_hash/outputs_gemini/gemini-3-pro-preview TEMP_0.2.js @@ -0,0 +1,7 @@ +const hashPassword = async (p, s) => { + const { scrypt } = await import('https://esm.sh/scrypt-js') + const e = new TextEncoder() + const k = await scrypt(e.encode(p), e.encode(s), 1024, 8, 1, 32) + return [...k].map(b => b.toString(16).padStart(2, '0')).join('') +} +export default hashPassword; \ No newline at end of file diff --git a/tests/10_scrypt_hash/outputs_gemini/gemini-3-pro-preview TEMP_0.3.js b/tests/10_scrypt_hash/outputs_gemini/gemini-3-pro-preview TEMP_0.3.js new file mode 100644 index 0000000..d98f403 --- /dev/null +++ b/tests/10_scrypt_hash/outputs_gemini/gemini-3-pro-preview TEMP_0.3.js @@ -0,0 +1,7 @@ +const hashPassword = async (p, s) => { + const { scrypt } = await import('https://esm.sh/scrypt-js') + const e = new TextEncoder() + const k = await scrypt(e.encode(p), e.encode(s), 1024, 8, 1, 32) + return [...k].map(b => b.toString(16).padStart(2, '0')).join('') +} +export default hashPassword; \ No newline at end of file diff --git a/tests/10_scrypt_hash/outputs_gemini/gemini-3-pro-preview TEMP_0.4.js b/tests/10_scrypt_hash/outputs_gemini/gemini-3-pro-preview TEMP_0.4.js new file mode 100644 index 0000000..be315d2 --- /dev/null +++ b/tests/10_scrypt_hash/outputs_gemini/gemini-3-pro-preview TEMP_0.4.js @@ -0,0 +1,7 @@ +const hashPassword = async (p, s) => { + const { scrypt } = await import('https://esm.sh/scrypt-js'); + const e = new TextEncoder(); + const k = await scrypt(e.encode(p), e.encode(s), 1024, 8, 1, 32); + return [...k].map(b => b.toString(16).padStart(2, '0')).join(''); +}; +export default hashPassword; \ No newline at end of file diff --git a/tests/10_scrypt_hash/outputs_gemini/gemini-3-pro-preview TEMP_0.5.js b/tests/10_scrypt_hash/outputs_gemini/gemini-3-pro-preview TEMP_0.5.js new file mode 100644 index 0000000..daa549c --- /dev/null +++ b/tests/10_scrypt_hash/outputs_gemini/gemini-3-pro-preview TEMP_0.5.js @@ -0,0 +1,7 @@ +const hashPassword = async (p, s) => { + const { scrypt } = await import('https://cdn.jsdelivr.net/npm/scrypt-js@3.0.1/+esm') + const e = new TextEncoder() + const k = await scrypt(e.encode(p), e.encode(s), 1024, 8, 1, 32) + return Array.from(k, b => b.toString(16).padStart(2, '0')).join('') +} +export default hashPassword; \ No newline at end of file diff --git a/tests/10_scrypt_hash/outputs_gemini/gemini-3-pro-preview TEMP_0.6.js b/tests/10_scrypt_hash/outputs_gemini/gemini-3-pro-preview TEMP_0.6.js new file mode 100644 index 0000000..a8fb52e --- /dev/null +++ b/tests/10_scrypt_hash/outputs_gemini/gemini-3-pro-preview TEMP_0.6.js @@ -0,0 +1,7 @@ +const hashPassword = async (p, s) => { + const { scrypt } = await import('https://unpkg.com/scrypt-js?module') + const e = new TextEncoder() + const k = await scrypt(e.encode(p), e.encode(s), 1024, 8, 1, 32) + return [...k].map(b => b.toString(16).padStart(2, '0')).join('') +} +export default hashPassword; \ No newline at end of file diff --git a/tests/10_scrypt_hash/outputs_gemini/gemini-3-pro-preview TEMP_0.7.js b/tests/10_scrypt_hash/outputs_gemini/gemini-3-pro-preview TEMP_0.7.js new file mode 100644 index 0000000..81db990 --- /dev/null +++ b/tests/10_scrypt_hash/outputs_gemini/gemini-3-pro-preview TEMP_0.7.js @@ -0,0 +1,7 @@ +const hashPassword = async (p, s) => { + const { scrypt } = await import('https://esm.sh/scrypt-js') + const e = new TextEncoder() + const k = await scrypt(e.encode(p), e.encode(s), 1024, 8, 1, 32) + return [...k].map(b => b.toString(16).padStart(2, 0)).join('') +} +export default hashPassword; \ No newline at end of file diff --git a/tests/10_scrypt_hash/outputs_gemini/gemini-3-pro-preview TEMP_0.8.js b/tests/10_scrypt_hash/outputs_gemini/gemini-3-pro-preview TEMP_0.8.js new file mode 100644 index 0000000..03cff67 --- /dev/null +++ b/tests/10_scrypt_hash/outputs_gemini/gemini-3-pro-preview TEMP_0.8.js @@ -0,0 +1,7 @@ +const hashPassword = async (p, s) => { + const { scrypt } = await import('https://esm.sh/scrypt-js') + const e = new TextEncoder() + const k = await scrypt(e.encode(p), e.encode(s), 1024, 8, 1, 32) + return Array.from(k, b => b.toString(16).padStart(2, '0')).join('') +} +export default hashPassword; \ No newline at end of file diff --git a/tests/10_scrypt_hash/outputs_gemini/gemini-3-pro-preview TEMP_0.9.js b/tests/10_scrypt_hash/outputs_gemini/gemini-3-pro-preview TEMP_0.9.js new file mode 100644 index 0000000..0eee31a --- /dev/null +++ b/tests/10_scrypt_hash/outputs_gemini/gemini-3-pro-preview TEMP_0.9.js @@ -0,0 +1,7 @@ +const hashPassword = async (pwd, salt) => { + const { scrypt } = await import('https://esm.sh/scrypt-js') + const enc = txt => new TextEncoder().encode(txt) + const key = await scrypt(enc(pwd), enc(salt), 1024, 8, 1, 32) + return Array.from(key, b => b.toString(16).padStart(2, '0')).join('') +} +export default hashPassword; \ No newline at end of file diff --git a/tests/10_scrypt_hash/outputs_gemini/gemini-3-pro-preview TEMP_0.js b/tests/10_scrypt_hash/outputs_gemini/gemini-3-pro-preview TEMP_0.js new file mode 100644 index 0000000..d98f403 --- /dev/null +++ b/tests/10_scrypt_hash/outputs_gemini/gemini-3-pro-preview TEMP_0.js @@ -0,0 +1,7 @@ +const hashPassword = async (p, s) => { + const { scrypt } = await import('https://esm.sh/scrypt-js') + const e = new TextEncoder() + const k = await scrypt(e.encode(p), e.encode(s), 1024, 8, 1, 32) + return [...k].map(b => b.toString(16).padStart(2, '0')).join('') +} +export default hashPassword; \ No newline at end of file diff --git a/tests/10_scrypt_hash/outputs_gemini/gemini-3-pro-preview TEMP_1.1.js b/tests/10_scrypt_hash/outputs_gemini/gemini-3-pro-preview TEMP_1.1.js new file mode 100644 index 0000000..dbb359c --- /dev/null +++ b/tests/10_scrypt_hash/outputs_gemini/gemini-3-pro-preview TEMP_1.1.js @@ -0,0 +1,7 @@ +const hashPassword = async (p, s) => { + const { scrypt } = await import('https://esm.sh/scrypt-js@3.0.1') + const e = new TextEncoder() + const k = await scrypt(e.encode(p), e.encode(s), 1024, 8, 1, 32) + return [...k].map(b => (b + 256).toString(16).slice(1)).join('') +} +export default hashPassword; \ No newline at end of file diff --git a/tests/10_scrypt_hash/outputs_gemini/gemini-3-pro-preview TEMP_1.js b/tests/10_scrypt_hash/outputs_gemini/gemini-3-pro-preview TEMP_1.js new file mode 100644 index 0000000..d98f403 --- /dev/null +++ b/tests/10_scrypt_hash/outputs_gemini/gemini-3-pro-preview TEMP_1.js @@ -0,0 +1,7 @@ +const hashPassword = async (p, s) => { + const { scrypt } = await import('https://esm.sh/scrypt-js') + const e = new TextEncoder() + const k = await scrypt(e.encode(p), e.encode(s), 1024, 8, 1, 32) + return [...k].map(b => b.toString(16).padStart(2, '0')).join('') +} +export default hashPassword; \ No newline at end of file diff --git a/tests/11_geospatial/outputs_gemini/gemini-3-pro-preview TEMP_0.1.js b/tests/11_geospatial/outputs_gemini/gemini-3-pro-preview TEMP_0.1.js new file mode 100644 index 0000000..0d97eeb --- /dev/null +++ b/tests/11_geospatial/outputs_gemini/gemini-3-pro-preview TEMP_0.1.js @@ -0,0 +1,10 @@ +const analyzeGPS = async (readings, boundary) => { + const T = await import('https://esm.sh/@turf/turf') + const pts = readings + .filter(r => T.booleanPointInPolygon(T.point(r.loc), boundary, { ignoreBoundary: true })) + .sort((a, b) => a.ts - b.ts) + .map(r => r.loc) + + return pts.length < 2 ? 0 : +T.length(T.lineString(pts), { units: 'kilometers' }).toFixed(2) +} +export default analyzeGPS; \ No newline at end of file diff --git a/tests/11_geospatial/outputs_gemini/gemini-3-pro-preview TEMP_0.2.js b/tests/11_geospatial/outputs_gemini/gemini-3-pro-preview TEMP_0.2.js new file mode 100644 index 0000000..326b005 --- /dev/null +++ b/tests/11_geospatial/outputs_gemini/gemini-3-pro-preview TEMP_0.2.js @@ -0,0 +1,12 @@ +const analyzeGPS = async (readings, boundary) => { + const t = await import('https://cdn.jsdelivr.net/npm/@turf/turf/+esm'); + + const pts = readings + .filter(({ loc }) => t.booleanPointInPolygon(t.point(loc), boundary, { ignoreBoundary: true })) + .sort((a, b) => a.ts - b.ts) + .map(({ loc }) => loc); + + return pts.length < 2 ? 0 : + Math.round(t.length(t.lineString(pts), { units: 'kilometers' }) * 100) / 100; +}; +export default analyzeGPS; \ No newline at end of file diff --git a/tests/11_geospatial/outputs_gemini/gemini-3-pro-preview TEMP_0.3.js b/tests/11_geospatial/outputs_gemini/gemini-3-pro-preview TEMP_0.3.js new file mode 100644 index 0000000..fbbdee8 --- /dev/null +++ b/tests/11_geospatial/outputs_gemini/gemini-3-pro-preview TEMP_0.3.js @@ -0,0 +1,14 @@ +const analyzeGPS = async (readings, boundary) => { + const T = await import('https://esm.sh/@turf/turf'); + + const pts = readings + .filter(r => T.booleanPointInPolygon(T.point(r.loc), boundary, { ignoreBoundary: true })) + .sort((a, b) => a.ts - b.ts) + .map(r => r.loc); + + if (pts.length < 2) return 0; + + const len = T.length(T.lineString(pts), { units: 'kilometers' }); + return Math.round(len * 100) / 100; +}; +export default analyzeGPS; \ No newline at end of file diff --git a/tests/11_geospatial/outputs_gemini/gemini-3-pro-preview TEMP_0.4.js b/tests/11_geospatial/outputs_gemini/gemini-3-pro-preview TEMP_0.4.js new file mode 100644 index 0000000..326b005 --- /dev/null +++ b/tests/11_geospatial/outputs_gemini/gemini-3-pro-preview TEMP_0.4.js @@ -0,0 +1,12 @@ +const analyzeGPS = async (readings, boundary) => { + const t = await import('https://cdn.jsdelivr.net/npm/@turf/turf/+esm'); + + const pts = readings + .filter(({ loc }) => t.booleanPointInPolygon(t.point(loc), boundary, { ignoreBoundary: true })) + .sort((a, b) => a.ts - b.ts) + .map(({ loc }) => loc); + + return pts.length < 2 ? 0 : + Math.round(t.length(t.lineString(pts), { units: 'kilometers' }) * 100) / 100; +}; +export default analyzeGPS; \ No newline at end of file diff --git a/tests/11_geospatial/outputs_gemini/gemini-3-pro-preview TEMP_0.5.js b/tests/11_geospatial/outputs_gemini/gemini-3-pro-preview TEMP_0.5.js new file mode 100644 index 0000000..36d1e9f --- /dev/null +++ b/tests/11_geospatial/outputs_gemini/gemini-3-pro-preview TEMP_0.5.js @@ -0,0 +1,13 @@ +const analyzeGPS = async (readings, boundary) => { + const { booleanPointInPolygon, point, lineString, length } = await import('https://esm.sh/@turf/turf'); + + const coords = readings + .filter(({ loc }) => booleanPointInPolygon(point(loc), boundary, { ignoreBoundary: true })) + .sort((a, b) => a.ts - b.ts) + .map(({ loc }) => loc); + + return coords.length < 2 + ? 0 + : +length(lineString(coords), { units: 'kilometers' }).toFixed(2); +}; +export default analyzeGPS; \ No newline at end of file diff --git a/tests/11_geospatial/outputs_gemini/gemini-3-pro-preview TEMP_0.6.js b/tests/11_geospatial/outputs_gemini/gemini-3-pro-preview TEMP_0.6.js new file mode 100644 index 0000000..b3db285 --- /dev/null +++ b/tests/11_geospatial/outputs_gemini/gemini-3-pro-preview TEMP_0.6.js @@ -0,0 +1,10 @@ +const analyzeGPS = async (readings, boundary) => { + const t = await import('https://esm.sh/@turf/turf'); + const pts = readings + .filter(r => t.booleanPointInPolygon(t.point(r.loc), boundary, { ignoreBoundary: true })) + .sort((a, b) => a.ts - b.ts) + .map(r => r.loc); + + return pts.length < 2 ? 0 : +t.length(t.lineString(pts), { units: 'kilometers' }).toFixed(2); +}; +export default analyzeGPS; \ No newline at end of file diff --git a/tests/11_geospatial/outputs_gemini/gemini-3-pro-preview TEMP_0.7.js b/tests/11_geospatial/outputs_gemini/gemini-3-pro-preview TEMP_0.7.js new file mode 100644 index 0000000..c19352d --- /dev/null +++ b/tests/11_geospatial/outputs_gemini/gemini-3-pro-preview TEMP_0.7.js @@ -0,0 +1,12 @@ +const analyzeGPS = async (readings, boundary) => { + const { booleanPointInPolygon, point, lineString, length } = await import('https://esm.sh/@turf/turf'); + + const path = readings + .filter(({ loc }) => booleanPointInPolygon(point(loc), boundary, { ignoreBoundary: true })) + .sort((a, b) => a.ts - b.ts) + .map(({ loc }) => loc); + + return path.length < 2 ? 0 : + Math.round(length(lineString(path), { units: 'kilometers' }) * 100) / 100; +}; +export default analyzeGPS; \ No newline at end of file diff --git a/tests/11_geospatial/outputs_gemini/gemini-3-pro-preview TEMP_0.8.js b/tests/11_geospatial/outputs_gemini/gemini-3-pro-preview TEMP_0.8.js new file mode 100644 index 0000000..20a08ec --- /dev/null +++ b/tests/11_geospatial/outputs_gemini/gemini-3-pro-preview TEMP_0.8.js @@ -0,0 +1,10 @@ +const analyzeGPS = async (readings, boundary) => { + const T = await import('https://cdn.jsdelivr.net/npm/@turf/turf/+esm') + const pts = readings + .filter(r => T.booleanPointInPolygon(T.point(r.loc), boundary, { ignoreBoundary: true })) + .sort((a, b) => a.ts - b.ts) + .map(r => r.loc) + + return pts.length < 2 ? 0 : +T.length(T.lineString(pts), { units: 'kilometers' }).toFixed(2) +} +export default analyzeGPS; \ No newline at end of file diff --git a/tests/11_geospatial/outputs_gemini/gemini-3-pro-preview TEMP_0.9.js b/tests/11_geospatial/outputs_gemini/gemini-3-pro-preview TEMP_0.9.js new file mode 100644 index 0000000..2c0351f --- /dev/null +++ b/tests/11_geospatial/outputs_gemini/gemini-3-pro-preview TEMP_0.9.js @@ -0,0 +1,12 @@ +const analyzeGPS = async (readings, boundary) => { + const { booleanPointInPolygon, point, lineString, length } = await import('https://esm.sh/@turf/turf'); + + const pts = readings + .filter(r => booleanPointInPolygon(point(r.loc), boundary, { ignoreBoundary: true })) + .sort((a, b) => a.ts - b.ts) + .map(r => r.loc); + + return pts.length < 2 ? 0 + : +length(lineString(pts), { units: 'kilometers' }).toFixed(2); +}; +export default analyzeGPS; \ No newline at end of file diff --git a/tests/11_geospatial/outputs_gemini/gemini-3-pro-preview TEMP_0.js b/tests/11_geospatial/outputs_gemini/gemini-3-pro-preview TEMP_0.js new file mode 100644 index 0000000..e228f5d --- /dev/null +++ b/tests/11_geospatial/outputs_gemini/gemini-3-pro-preview TEMP_0.js @@ -0,0 +1,12 @@ +const analyzeGPS = async (readings, boundary) => { + const { booleanPointInPolygon, point, lineString, length } = await import('https://esm.sh/@turf/turf'); + + const coords = readings + .filter(({ loc }) => booleanPointInPolygon(point(loc), boundary, { ignoreBoundary: true })) + .sort((a, b) => a.ts - b.ts) + .map(({ loc }) => loc); + + return coords.length < 2 ? 0 : + Math.round(length(lineString(coords), { units: 'kilometers' }) * 100) / 100; +}; +export default analyzeGPS; \ No newline at end of file diff --git a/tests/11_geospatial/outputs_gemini/gemini-3-pro-preview TEMP_1.1.js b/tests/11_geospatial/outputs_gemini/gemini-3-pro-preview TEMP_1.1.js new file mode 100644 index 0000000..1140a00 --- /dev/null +++ b/tests/11_geospatial/outputs_gemini/gemini-3-pro-preview TEMP_1.1.js @@ -0,0 +1,14 @@ +const analyzeGPS = async (readings, boundary) => { + const { booleanPointInPolygon, point, lineString, length } = await import('https://esm.sh/@turf/turf') + + const path = readings + .filter(({ loc }) => booleanPointInPolygon(point(loc), boundary)) + .sort((a, b) => a.ts - b.ts) + .map(({ loc }) => loc) + + if (path.length < 2) return 0 + + const dist = length(lineString(path), { units: 'kilometers' }) + return Math.round(dist * 100) / 100 +} +export default analyzeGPS; \ No newline at end of file diff --git a/tests/11_geospatial/outputs_gemini/gemini-3-pro-preview TEMP_1.js b/tests/11_geospatial/outputs_gemini/gemini-3-pro-preview TEMP_1.js new file mode 100644 index 0000000..f3dd564 --- /dev/null +++ b/tests/11_geospatial/outputs_gemini/gemini-3-pro-preview TEMP_1.js @@ -0,0 +1,14 @@ +const analyzeGPS = async (readings, boundary) => { + const { booleanPointInPolygon, point, lineString, length } = await import('https://esm.sh/@turf/turf') + + const path = readings + .filter(({ loc }) => booleanPointInPolygon(point(loc), boundary, { ignoreBoundary: true })) + .sort((a, b) => a.ts - b.ts) + .map(({ loc }) => loc) + + if (path.length < 2) return 0 + + const dist = length(lineString(path), { units: 'kilometers' }) + return Math.round(dist * 100) / 100 +} +export default analyzeGPS; \ No newline at end of file diff --git a/tests/1_dijkstra/outputs_gemini/gemini-3-pro-preview TEMP_0.1.js b/tests/1_dijkstra/outputs_gemini/gemini-3-pro-preview TEMP_0.1.js new file mode 100644 index 0000000..4729419 --- /dev/null +++ b/tests/1_dijkstra/outputs_gemini/gemini-3-pro-preview TEMP_0.1.js @@ -0,0 +1,22 @@ +const findShortestPath = async (g, s, e) => { + const { default: Q } = await import('https://esm.sh/js-priority-queue') + const q = new Q({ comparator: (a, b) => a.w - b.w }) + const d = { [s]: 0 } + q.queue({ n: s, w: 0 }) + + while (q.length) { + const { n, w } = q.dequeue() + if (n === e) return w + if (w > (d[n] ?? 1/0)) continue + + for (let v in g[n]) { + let t = w + g[n][v] + if (t < (d[v] ?? 1/0)) { + d[v] = t + q.queue({ n: v, w: t }) + } + } + } + return 1/0 +} +export default findShortestPath; \ No newline at end of file diff --git a/tests/1_dijkstra/outputs_gemini/gemini-3-pro-preview TEMP_0.2.js b/tests/1_dijkstra/outputs_gemini/gemini-3-pro-preview TEMP_0.2.js new file mode 100644 index 0000000..4a113fc --- /dev/null +++ b/tests/1_dijkstra/outputs_gemini/gemini-3-pro-preview TEMP_0.2.js @@ -0,0 +1,19 @@ +const findShortestPath = async (g, s, e) => { + const { default: P } = await import('https://esm.sh/js-priority-queue'); + const q = new P({ comparator: (a, b) => a.w - b.w }), d = { [s]: 0 }; + q.queue({ n: s, w: 0 }); + while (q.length) { + const { n, w } = q.dequeue(); + if (n === e) return w; + if (w > (d[n] ?? 1 / 0)) continue; + for (const k in g[n] || {}) { + const t = w + g[n][k]; + if (t < (d[k] ?? 1 / 0)) { + d[k] = t; + q.queue({ n: k, w: t }); + } + } + } + return 1 / 0; +}; +export default findShortestPath; \ No newline at end of file diff --git a/tests/1_dijkstra/outputs_gemini/gemini-3-pro-preview TEMP_0.3.js b/tests/1_dijkstra/outputs_gemini/gemini-3-pro-preview TEMP_0.3.js new file mode 100644 index 0000000..6af6468 --- /dev/null +++ b/tests/1_dijkstra/outputs_gemini/gemini-3-pro-preview TEMP_0.3.js @@ -0,0 +1,20 @@ +const findShortestPath = async (g, s, e) => { + const { default: P } = await import('https://esm.sh/js-priority-queue') + const q = new P({ comparator: (a, b) => a.w - b.w }) + const m = { [s]: 0 } + q.queue({ n: s, w: 0 }) + while (q.length) { + const { n, w } = q.dequeue() + if (n === e) return w + if (w > (m[n] ?? 1 / 0)) continue + for (const k in g[n] || {}) { + const t = w + g[n][k] + if (t < (m[k] ?? 1 / 0)) { + m[k] = t + q.queue({ n: k, w: t }) + } + } + } + return 1 / 0 +} +export default findShortestPath; \ No newline at end of file diff --git a/tests/1_dijkstra/outputs_gemini/gemini-3-pro-preview TEMP_0.4.js b/tests/1_dijkstra/outputs_gemini/gemini-3-pro-preview TEMP_0.4.js new file mode 100644 index 0000000..1ae0fc6 --- /dev/null +++ b/tests/1_dijkstra/outputs_gemini/gemini-3-pro-preview TEMP_0.4.js @@ -0,0 +1,22 @@ +const findShortestPath = async (g, s, e) => { + const { default: PQ } = await import('https://esm.sh/js-priority-queue') + const q = new PQ({ comparator: (a, b) => a.w - b.w }) + const d = { [s]: 0 } + q.queue({ n: s, w: 0 }) + + while (q.length) { + const { n, w } = q.dequeue() + if (n === e) return w + if (w > (d[n] ?? 1 / 0)) continue + + for (const [v, cost] of Object.entries(g[n] || {})) { + const t = w + cost + if (t < (d[v] ?? 1 / 0)) { + d[v] = t + q.queue({ n: v, w: t }) + } + } + } + return 1 / 0 +} +export default findShortestPath; \ No newline at end of file diff --git a/tests/1_dijkstra/outputs_gemini/gemini-3-pro-preview TEMP_0.5.js b/tests/1_dijkstra/outputs_gemini/gemini-3-pro-preview TEMP_0.5.js new file mode 100644 index 0000000..ad292fe --- /dev/null +++ b/tests/1_dijkstra/outputs_gemini/gemini-3-pro-preview TEMP_0.5.js @@ -0,0 +1,19 @@ +const findShortestPath = async (g, s, e) => { + const { default: Q } = await import('https://esm.sh/js-priority-queue') + const d = { [s]: 0 }, q = new Q({ comparator: (a, b) => a.w - b.w }) + q.queue({ n: s, w: 0 }) + while (q.length) { + const { n, w } = q.dequeue() + if (n === e) return w + if (w > (d[n] ?? 1 / 0)) continue + for (const [v, c] of Object.entries(g[n] || {})) { + const k = w + c + if (k < (d[v] ?? 1 / 0)) { + d[v] = k + q.queue({ n: v, w: k }) + } + } + } + return 1 / 0 +} +export default findShortestPath; \ No newline at end of file diff --git a/tests/1_dijkstra/outputs_gemini/gemini-3-pro-preview TEMP_0.6.js b/tests/1_dijkstra/outputs_gemini/gemini-3-pro-preview TEMP_0.6.js new file mode 100644 index 0000000..24e12bb --- /dev/null +++ b/tests/1_dijkstra/outputs_gemini/gemini-3-pro-preview TEMP_0.6.js @@ -0,0 +1,24 @@ +const findShortestPath = async (g, s, e) => { + const { default: PQ } = await import('https://esm.sh/js-priority-queue') + const q = new PQ({ comparator: (a, b) => a.w - b.w }) + const d = { [s]: 0 }, v = new Set() + + q.queue({ n: s, w: 0 }) + + while (q.length) { + const { n, w } = q.dequeue() + if (n === e) return w + if (v.has(n)) continue + v.add(n) + + for (const k in g[n]) { + const t = w + g[n][k] + if (t < (d[k] ?? Infinity)) { + d[k] = t + q.queue({ n: k, w: t }) + } + } + } + return Infinity +} +export default findShortestPath; \ No newline at end of file diff --git a/tests/1_dijkstra/outputs_gemini/gemini-3-pro-preview TEMP_0.7.js b/tests/1_dijkstra/outputs_gemini/gemini-3-pro-preview TEMP_0.7.js new file mode 100644 index 0000000..a6d3943 --- /dev/null +++ b/tests/1_dijkstra/outputs_gemini/gemini-3-pro-preview TEMP_0.7.js @@ -0,0 +1,25 @@ +const findShortestPath = async (g, s, e) => { + const { default: PQ } = await import('https://esm.sh/js-priority-queue'); + const q = new PQ({ comparator: (a, b) => a.w - b.w }); + const d = { [s]: 0 }; + + q.queue({ w: 0, n: s }); + + while (q.length) { + const { w, n } = q.dequeue(); + + if (n === e) return w; + if (w > (d[n] ?? 1 / 0)) continue; + + for (const v in g[n]) { + const k = w + g[n][v]; + if (k < (d[v] ?? 1 / 0)) { + d[v] = k; + q.queue({ w: k, n: v }); + } + } + } + + return 1 / 0; +}; +export default findShortestPath; \ No newline at end of file diff --git a/tests/1_dijkstra/outputs_gemini/gemini-3-pro-preview TEMP_0.8.js b/tests/1_dijkstra/outputs_gemini/gemini-3-pro-preview TEMP_0.8.js new file mode 100644 index 0000000..5dbc719 --- /dev/null +++ b/tests/1_dijkstra/outputs_gemini/gemini-3-pro-preview TEMP_0.8.js @@ -0,0 +1,19 @@ +const findShortestPath = async (g, s, e) => { + const { default: P } = await import('https://esm.sh/js-priority-queue'); + const q = new P({ comparator: (a, b) => a.c - b.c }), d = { [s]: 0 }; + q.queue({ n: s, c: 0 }); + while (q.length) { + const { n, c } = q.dequeue(); + if (n === e) return c; + if (c > (d[n] ?? 1 / 0)) continue; + for (let v in g[n]) { + let k = c + g[n][v]; + if (k < (d[v] ?? 1 / 0)) { + d[v] = k; + q.queue({ n: v, c: k }); + } + } + } + return 1 / 0; +}; +export default findShortestPath; \ No newline at end of file diff --git a/tests/1_dijkstra/outputs_gemini/gemini-3-pro-preview TEMP_0.9.js b/tests/1_dijkstra/outputs_gemini/gemini-3-pro-preview TEMP_0.9.js new file mode 100644 index 0000000..1e1528c --- /dev/null +++ b/tests/1_dijkstra/outputs_gemini/gemini-3-pro-preview TEMP_0.9.js @@ -0,0 +1,25 @@ +const findShortestPath = async (g, s, e) => { + const { default: PQ } = await import('https://cdn.jsdelivr.net/npm/js-priority-queue@0.1.5/+esm') + const q = new PQ({ comparator: (a, b) => a.w - b.w }) + const d = { [s]: 0 } + + q.queue({ n: s, w: 0 }) + + while (q.length) { + const { n, w } = q.dequeue() + + if (n === e) return w + if (w > (d[n] ?? 1 / 0)) continue + + for (const k in g[n] || {}) { + const c = w + g[n][k] + if (c < (d[k] ?? 1 / 0)) { + d[k] = c + q.queue({ n: k, w: c }) + } + } + } + + return 1 / 0 +} +export default findShortestPath; \ No newline at end of file diff --git a/tests/1_dijkstra/outputs_gemini/gemini-3-pro-preview TEMP_0.js b/tests/1_dijkstra/outputs_gemini/gemini-3-pro-preview TEMP_0.js new file mode 100644 index 0000000..b4088da --- /dev/null +++ b/tests/1_dijkstra/outputs_gemini/gemini-3-pro-preview TEMP_0.js @@ -0,0 +1,19 @@ +const findShortestPath = async (g, s, e) => { + const { default: PQ } = await import('https://esm.sh/js-priority-queue') + const q = new PQ({ comparator: (a, b) => a.w - b.w }), d = { [s]: 0 } + q.queue({ n: s, w: 0 }) + while (q.length) { + const { n, w } = q.dequeue() + if (n === e) return w + if (w > (d[n] ?? 1/0)) continue + for (const [v, c] of Object.entries(g[n] || {})) { + const k = w + c + if (k < (d[v] ?? 1/0)) { + d[v] = k + q.queue({ n: v, w: k }) + } + } + } + return 1/0 +} +export default findShortestPath; \ No newline at end of file diff --git a/tests/1_dijkstra/outputs_gemini/gemini-3-pro-preview TEMP_1.1.js b/tests/1_dijkstra/outputs_gemini/gemini-3-pro-preview TEMP_1.1.js new file mode 100644 index 0000000..e3d76a7 --- /dev/null +++ b/tests/1_dijkstra/outputs_gemini/gemini-3-pro-preview TEMP_1.1.js @@ -0,0 +1,25 @@ +const findShortestPath = async (graph, start, end) => { + const { default: PQ } = await import('https://cdn.jsdelivr.net/npm/js-priority-queue/+esm') + const costs = { [start]: 0 } + const queue = new PQ({ comparator: (a, b) => a.cost - b.cost }) + + queue.queue({ node: start, cost: 0 }) + + while (queue.length) { + const { node, cost } = queue.dequeue() + + if (node === end) return cost + if (cost > (costs[node] ?? Infinity)) continue + + for (const [neighbor, weight] of Object.entries(graph[node] || {})) { + const nextCost = cost + weight + if (nextCost < (costs[neighbor] ?? Infinity)) { + costs[neighbor] = nextCost + queue.queue({ node: neighbor, cost: nextCost }) + } + } + } + + return Infinity +} +export default findShortestPath; \ No newline at end of file diff --git a/tests/1_dijkstra/outputs_gemini/gemini-3-pro-preview TEMP_1.js b/tests/1_dijkstra/outputs_gemini/gemini-3-pro-preview TEMP_1.js new file mode 100644 index 0000000..3fb4d38 --- /dev/null +++ b/tests/1_dijkstra/outputs_gemini/gemini-3-pro-preview TEMP_1.js @@ -0,0 +1,24 @@ +const findShortestPath = async (graph, start, end) => { + const { default: PQ } = await import('https://cdn.skypack.dev/js-priority-queue'); + const queue = new PQ({ comparator: (a, b) => a.d - b.d }); + const dists = { [start]: 0 }, visited = new Set(); + + queue.queue({ n: start, d: 0 }); + + while (queue.length) { + const { n, d } = queue.dequeue(); + if (n === end) return d; + if (visited.has(n)) continue; + visited.add(n); + + for (const [neighbor, weight] of Object.entries(graph[n] || {})) { + const newDist = d + weight; + if (newDist < (dists[neighbor] ?? Infinity)) { + dists[neighbor] = newDist; + queue.queue({ n: neighbor, d: newDist }); + } + } + } + return Infinity; +}; +export default findShortestPath; \ No newline at end of file diff --git a/tests/2_convex_hull/outputs_gemini/gemini-3-pro-preview TEMP_0.1.js b/tests/2_convex_hull/outputs_gemini/gemini-3-pro-preview TEMP_0.1.js new file mode 100644 index 0000000..f4ff180 --- /dev/null +++ b/tests/2_convex_hull/outputs_gemini/gemini-3-pro-preview TEMP_0.1.js @@ -0,0 +1,15 @@ +const findConvexHull = async (pts) => { + const { default: _ } = await import('https://cdn.jsdelivr.net/npm/lodash@4.17.21/+esm') + const s = _.sortBy(_.uniqWith(pts, _.isEqual), ['x', 'y']) + if (s.length < 3) return s + const x = (a, b, c) => (b.x - a.x) * (c.y - a.y) - (b.y - a.y) * (c.x - a.x) + const m = (l) => l.reduce((h, p) => { + while (h.length >= 2 && x(h[h.length - 2], h[h.length - 1], p) <= 0) h.pop() + h.push(p) + return h + }, []) + const l = m(s) + const u = m([...s].reverse()) + return [...l.slice(0, -1), ...u.slice(0, -1)] +} +export default findConvexHull; \ No newline at end of file diff --git a/tests/2_convex_hull/outputs_gemini/gemini-3-pro-preview TEMP_0.2.js b/tests/2_convex_hull/outputs_gemini/gemini-3-pro-preview TEMP_0.2.js new file mode 100644 index 0000000..8454638 --- /dev/null +++ b/tests/2_convex_hull/outputs_gemini/gemini-3-pro-preview TEMP_0.2.js @@ -0,0 +1,13 @@ +const findConvexHull = async (pts) => { + const { default: _ } = await import('https://cdn.jsdelivr.net/npm/lodash@4.17.21/+esm'); + const s = _.sortBy(_.uniqWith(pts, _.isEqual), ['x', 'y']); + if (s.length < 3) return s; + const k = (a, b, c) => (b.x - a.x) * (c.y - a.y) - (b.y - a.y) * (c.x - a.x); + const f = (h, p) => { + while (h.length > 1 && k(h[h.length - 2], h[h.length - 1], p) <= 0) h.pop(); + h.push(p); + return h; + }; + return [...s.reduce(f, []).slice(0, -1), ...s.reduceRight(f, []).slice(0, -1)]; +}; +export default findConvexHull; \ No newline at end of file diff --git a/tests/2_convex_hull/outputs_gemini/gemini-3-pro-preview TEMP_0.3.js b/tests/2_convex_hull/outputs_gemini/gemini-3-pro-preview TEMP_0.3.js new file mode 100644 index 0000000..0a35936 --- /dev/null +++ b/tests/2_convex_hull/outputs_gemini/gemini-3-pro-preview TEMP_0.3.js @@ -0,0 +1,27 @@ +const findConvexHull = async (pts) => { + const { default: _ } = await import('https://cdn.jsdelivr.net/npm/lodash@4.17.21/+esm'); + + if (!Array.isArray(pts)) throw new Error('Input must be an array'); + const u = _.uniqWith(pts, _.isEqual); + if (u.length < 3) return u; + + const s = _.sortBy(u, ['x', 'y']); + const k = (a, b, c) => (b.x - a.x) * (c.y - a.y) - (b.y - a.y) * (c.x - a.x); + const h = []; + + for (const p of s) { + while (h.length >= 2 && k(h[h.length - 2], h[h.length - 1], p) <= 0) h.pop(); + h.push(p); + } + + const t = h.length + 1; + for (let i = s.length - 2; i >= 0; i--) { + const p = s[i]; + while (h.length >= t && k(h[h.length - 2], h[h.length - 1], p) <= 0) h.pop(); + h.push(p); + } + + h.pop(); + return h; +}; +export default findConvexHull; \ No newline at end of file diff --git a/tests/2_convex_hull/outputs_gemini/gemini-3-pro-preview TEMP_0.4.js b/tests/2_convex_hull/outputs_gemini/gemini-3-pro-preview TEMP_0.4.js new file mode 100644 index 0000000..daab7dc --- /dev/null +++ b/tests/2_convex_hull/outputs_gemini/gemini-3-pro-preview TEMP_0.4.js @@ -0,0 +1,24 @@ +const findConvexHull = async (pts) => { + const { default: _ } = await import('https://cdn.jsdelivr.net/npm/lodash@4.17.21/+esm') + const s = _.sortBy(_.uniqWith(pts, _.isEqual), ['x', 'y']) + if (s.length < 3) return s + + const cross = (a, b, o) => (a.x - o.x) * (b.y - o.y) - (a.y - o.y) * (b.x - o.x) + const build = (list) => { + const h = [] + for (const p of list) { + while (h.length >= 2 && cross(h[h.length - 1], p, h[h.length - 2]) <= 0) h.pop() + h.push(p) + } + return h + } + + const l = build(s) + const u = build([...s].reverse()) + + l.pop() + u.pop() + + return [...l, ...u] +} +export default findConvexHull; \ No newline at end of file diff --git a/tests/2_convex_hull/outputs_gemini/gemini-3-pro-preview TEMP_0.5.js b/tests/2_convex_hull/outputs_gemini/gemini-3-pro-preview TEMP_0.5.js new file mode 100644 index 0000000..6981d54 --- /dev/null +++ b/tests/2_convex_hull/outputs_gemini/gemini-3-pro-preview TEMP_0.5.js @@ -0,0 +1,16 @@ +const findConvexHull = async (pts) => { + const { default: _ } = await import('https://cdn.jsdelivr.net/npm/lodash@4.17.21/+esm') + const u = _.uniqWith(pts, _.isEqual) + if (u.length < 3) return u + const s = _.sortBy(u, ['x', 'y']) + const cp = (o, a, b) => (a.x - o.x) * (b.y - o.y) - (a.y - o.y) * (b.x - o.x) + const scan = (lst) => lst.reduce((h, p) => { + while (h.length >= 2 && cp(h[h.length - 2], h[h.length - 1], p) <= 0) h.pop() + h.push(p) + return h + }, []) + const l = scan(s) + const up = scan([...s].reverse()) + return [...l.slice(0, -1), ...up.slice(0, -1)] +} +export default findConvexHull; \ No newline at end of file diff --git a/tests/2_convex_hull/outputs_gemini/gemini-3-pro-preview TEMP_0.6.js b/tests/2_convex_hull/outputs_gemini/gemini-3-pro-preview TEMP_0.6.js new file mode 100644 index 0000000..ff2e4a3 --- /dev/null +++ b/tests/2_convex_hull/outputs_gemini/gemini-3-pro-preview TEMP_0.6.js @@ -0,0 +1,17 @@ +const findConvexHull = async (pts) => { + const { default: _ } = await import('https://cdn.jsdelivr.net/npm/lodash@4.17.21/+esm') + const s = _.sortBy(_.uniqWith(pts, _.isEqual), ['x', 'y']) + if (s.length < 3) return s + const k = (o, a, b) => (a.x - o.x) * (b.y - o.y) - (a.y - o.y) * (b.x - o.x) + const m = (v) => { + const h = [] + for (const p of v) { + while (h.length >= 2 && k(h[h.length - 2], h[h.length - 1], p) <= 0) h.pop() + h.push(p) + } + return h + } + const l = m(s), u = m(s.reverse()) + return l.slice(0, -1).concat(u.slice(0, -1)) +} +export default findConvexHull; \ No newline at end of file diff --git a/tests/2_convex_hull/outputs_gemini/gemini-3-pro-preview TEMP_0.7.js b/tests/2_convex_hull/outputs_gemini/gemini-3-pro-preview TEMP_0.7.js new file mode 100644 index 0000000..70abd52 --- /dev/null +++ b/tests/2_convex_hull/outputs_gemini/gemini-3-pro-preview TEMP_0.7.js @@ -0,0 +1,22 @@ +const findConvexHull = async points => { + const { default: _ } = await import('https://esm.sh/lodash') + const s = _.sortBy(_.uniqWith(points, _.isEqual), ['x', 'y']) + if (s.length < 3) return s + + const h = [], x = (a, b, c) => (b.x - a.x) * (c.y - a.y) - (b.y - a.y) * (c.x - a.x) + + s.forEach(p => { + while (h.length >= 2 && x(h.at(-2), h.at(-1), p) <= 0) h.pop() + h.push(p) + }) + + const t = h.length + 1 + for (let i = s.length - 2; i >= 0; i--) { + while (h.length >= t && x(h.at(-2), h.at(-1), s[i]) <= 0) h.pop() + h.push(s[i]) + } + + h.pop() + return h +} +export default findConvexHull; \ No newline at end of file diff --git a/tests/2_convex_hull/outputs_gemini/gemini-3-pro-preview TEMP_0.8.js b/tests/2_convex_hull/outputs_gemini/gemini-3-pro-preview TEMP_0.8.js new file mode 100644 index 0000000..9f05440 --- /dev/null +++ b/tests/2_convex_hull/outputs_gemini/gemini-3-pro-preview TEMP_0.8.js @@ -0,0 +1,24 @@ +const findConvexHull = async (pts) => { + const { default: _ } = await import('https://cdn.jsdelivr.net/npm/lodash@4.17.21/+esm'); + const s = _.sortBy(_.uniqWith(pts, _.isEqual), ['x', 'y']); + + if (s.length < 3) return s; + + const cross = (o, a, b) => (a.x - o.x) * (b.y - o.y) - (a.y - o.y) * (b.x - o.x); + const h = []; + + for (let i = 0; i < s.length; i++) { + while (h.length >= 2 && cross(h[h.length - 2], h[h.length - 1], s[i]) <= 0) h.pop(); + h.push(s[i]); + } + + const t = h.length + 1; + for (let i = s.length - 2; i >= 0; i--) { + while (h.length >= t && cross(h[h.length - 2], h[h.length - 1], s[i]) <= 0) h.pop(); + h.push(s[i]); + } + + h.pop(); + return h; +}; +export default findConvexHull; \ No newline at end of file diff --git a/tests/2_convex_hull/outputs_gemini/gemini-3-pro-preview TEMP_0.9.js b/tests/2_convex_hull/outputs_gemini/gemini-3-pro-preview TEMP_0.9.js new file mode 100644 index 0000000..8b2f382 --- /dev/null +++ b/tests/2_convex_hull/outputs_gemini/gemini-3-pro-preview TEMP_0.9.js @@ -0,0 +1,23 @@ +const findConvexHull = async (pts) => { + if (!pts?.length || pts.length < 3) return pts || []; + + const { default: _ } = await import('https://cdn.jsdelivr.net/npm/lodash@4.17.21/+esm'); + + const s = _.sortBy(_.uniqWith(pts, _.isEqual), ['x', 'y']); + const k = (a, b, c) => (b.x - a.x) * (c.y - a.y) - (b.y - a.y) * (c.x - a.x); + + const scan = (list) => { + const h = []; + for (const p of list) { + while (h.length >= 2 && k(h[h.length - 2], h[h.length - 1], p) <= 0) h.pop(); + h.push(p); + } + return h; + }; + + const l = scan(s); + const u = scan(s.reverse()); + + return [...l.slice(0, -1), ...u.slice(0, -1)]; +}; +export default findConvexHull; \ No newline at end of file diff --git a/tests/2_convex_hull/outputs_gemini/gemini-3-pro-preview TEMP_0.js b/tests/2_convex_hull/outputs_gemini/gemini-3-pro-preview TEMP_0.js new file mode 100644 index 0000000..3c8523e --- /dev/null +++ b/tests/2_convex_hull/outputs_gemini/gemini-3-pro-preview TEMP_0.js @@ -0,0 +1,19 @@ +const findConvexHull = async (pts) => { + const { default: _ } = await import('https://esm.sh/lodash'); + const u = _.uniqWith(pts, _.isEqual); + if (u.length < 3) return u; + const s = _.sortBy(u, ['x', 'y']); + const k = (a, b, c) => (b.x - a.x) * (c.y - a.y) - (b.y - a.y) * (c.x - a.x); + const f = (l) => { + const h = []; + for (const p of l) { + while (h.length >= 2 && k(h[h.length - 2], h[h.length - 1], p) <= 0) h.pop(); + h.push(p); + } + return h; + }; + const l = f(s); + const h = f([...s].reverse()); + return [...l.slice(0, -1), ...h.slice(0, -1)]; +}; +export default findConvexHull; \ No newline at end of file diff --git a/tests/2_convex_hull/outputs_gemini/gemini-3-pro-preview TEMP_1.1.js b/tests/2_convex_hull/outputs_gemini/gemini-3-pro-preview TEMP_1.1.js new file mode 100644 index 0000000..7e0ba91 --- /dev/null +++ b/tests/2_convex_hull/outputs_gemini/gemini-3-pro-preview TEMP_1.1.js @@ -0,0 +1,22 @@ +const findConvexHull = async (points) => { + const { default: _ } = await import('https://cdn.jsdelivr.net/npm/lodash@4.17.21/+esm') + const P = _.sortBy(_.uniqWith(points, _.isEqual), ['x', 'y']) + if (P.length < 3) return P + + const xp = (a, b, c) => (b.x - a.x) * (c.y - a.y) - (b.y - a.y) * (c.x - a.x) + + const scan = (arr) => { + const h = [] + for (const p of arr) { + while (h.length >= 2 && xp(h[h.length - 2], h[h.length - 1], p) <= 0) h.pop() + h.push(p) + } + return h + } + + const l = scan(P) + const u = scan(P.reverse()) + + return [...l.slice(0, -1), ...u.slice(0, -1)] +} +export default findConvexHull; \ No newline at end of file diff --git a/tests/2_convex_hull/outputs_gemini/gemini-3-pro-preview TEMP_1.js b/tests/2_convex_hull/outputs_gemini/gemini-3-pro-preview TEMP_1.js new file mode 100644 index 0000000..4de2579 --- /dev/null +++ b/tests/2_convex_hull/outputs_gemini/gemini-3-pro-preview TEMP_1.js @@ -0,0 +1,23 @@ +const findConvexHull = async (points) => { + const { default: _ } = await import('https://esm.sh/lodash'); + const P = _.sortBy(_.uniqWith(points, _.isEqual), ['x', 'y']); + if (P.length < 3) return P; + + const cross = (o, a, b) => (a.x - o.x) * (b.y - o.y) - (a.y - o.y) * (b.x - o.x); + const h = []; + + for (const p of P) { + while (h.length >= 2 && cross(h[h.length - 2], h[h.length - 1], p) <= 0) h.pop(); + h.push(p); + } + + const t = h.length + 1; + for (let i = P.length - 2; i >= 0; i--) { + while (h.length >= t && cross(h[h.length - 2], h[h.length - 1], P[i]) <= 0) h.pop(); + h.push(P[i]); + } + + h.pop(); + return h; +}; +export default findConvexHull; \ No newline at end of file diff --git a/tests/3_lis/outputs_gemini/gemini-3-pro-preview TEMP_0.1.js b/tests/3_lis/outputs_gemini/gemini-3-pro-preview TEMP_0.1.js new file mode 100644 index 0000000..2e94416 --- /dev/null +++ b/tests/3_lis/outputs_gemini/gemini-3-pro-preview TEMP_0.1.js @@ -0,0 +1,7 @@ +const findLISLength = async nums => { + const { bisectLeft } = await import('https://esm.sh/d3-array') + const tails = [] + for (const n of nums) tails[bisectLeft(tails, n)] = n + return tails.length +} +export default findLISLength; \ No newline at end of file diff --git a/tests/3_lis/outputs_gemini/gemini-3-pro-preview TEMP_0.2.js b/tests/3_lis/outputs_gemini/gemini-3-pro-preview TEMP_0.2.js new file mode 100644 index 0000000..af73b89 --- /dev/null +++ b/tests/3_lis/outputs_gemini/gemini-3-pro-preview TEMP_0.2.js @@ -0,0 +1,7 @@ +const findLISLength = async a => { + const { bisectLeft: b } = await import('https://cdn.jsdelivr.net/npm/d3-array@3/+esm') + const t = [] + for (const n of a) t[b(t, n)] = n + return t.length +} +export default findLISLength; \ No newline at end of file diff --git a/tests/3_lis/outputs_gemini/gemini-3-pro-preview TEMP_0.3.js b/tests/3_lis/outputs_gemini/gemini-3-pro-preview TEMP_0.3.js new file mode 100644 index 0000000..2e94416 --- /dev/null +++ b/tests/3_lis/outputs_gemini/gemini-3-pro-preview TEMP_0.3.js @@ -0,0 +1,7 @@ +const findLISLength = async nums => { + const { bisectLeft } = await import('https://esm.sh/d3-array') + const tails = [] + for (const n of nums) tails[bisectLeft(tails, n)] = n + return tails.length +} +export default findLISLength; \ No newline at end of file diff --git a/tests/3_lis/outputs_gemini/gemini-3-pro-preview TEMP_0.4.js b/tests/3_lis/outputs_gemini/gemini-3-pro-preview TEMP_0.4.js new file mode 100644 index 0000000..5266350 --- /dev/null +++ b/tests/3_lis/outputs_gemini/gemini-3-pro-preview TEMP_0.4.js @@ -0,0 +1,7 @@ +const findLISLength = async nums => { + const { bisectLeft } = await import('https://cdn.jsdelivr.net/npm/d3-array@3/+esm') + const tails = [] + for (const n of nums) tails[bisectLeft(tails, n)] = n + return tails.length +} +export default findLISLength; \ No newline at end of file diff --git a/tests/3_lis/outputs_gemini/gemini-3-pro-preview TEMP_0.5.js b/tests/3_lis/outputs_gemini/gemini-3-pro-preview TEMP_0.5.js new file mode 100644 index 0000000..7b3833d --- /dev/null +++ b/tests/3_lis/outputs_gemini/gemini-3-pro-preview TEMP_0.5.js @@ -0,0 +1,7 @@ +const findLISLength = async (nums) => { + const { bisectLeft } = await import('https://cdn.jsdelivr.net/npm/d3-array@3/+esm') + const tails = [] + for (const x of nums) tails[bisectLeft(tails, x)] = x + return tails.length +} +export default findLISLength; \ No newline at end of file diff --git a/tests/3_lis/outputs_gemini/gemini-3-pro-preview TEMP_0.6.js b/tests/3_lis/outputs_gemini/gemini-3-pro-preview TEMP_0.6.js new file mode 100644 index 0000000..90c831b --- /dev/null +++ b/tests/3_lis/outputs_gemini/gemini-3-pro-preview TEMP_0.6.js @@ -0,0 +1,11 @@ +const findLISLength = async (nums) => { + const { bisectLeft } = await import('https://esm.sh/d3-array') + const tails = [] + + for (const x of nums) { + tails[bisectLeft(tails, x)] = x + } + + return tails.length +} +export default findLISLength; \ No newline at end of file diff --git a/tests/3_lis/outputs_gemini/gemini-3-pro-preview TEMP_0.7.js b/tests/3_lis/outputs_gemini/gemini-3-pro-preview TEMP_0.7.js new file mode 100644 index 0000000..38f3539 --- /dev/null +++ b/tests/3_lis/outputs_gemini/gemini-3-pro-preview TEMP_0.7.js @@ -0,0 +1,9 @@ +const findLISLength = async n => { + const { bisectLeft: b } = await import('https://cdn.jsdelivr.net/npm/d3-array@3/+esm') + const t = [] + for (const x of n) { + t[b(t, x)] = x + } + return t.length +} +export default findLISLength; \ No newline at end of file diff --git a/tests/3_lis/outputs_gemini/gemini-3-pro-preview TEMP_0.8.js b/tests/3_lis/outputs_gemini/gemini-3-pro-preview TEMP_0.8.js new file mode 100644 index 0000000..8843d33 --- /dev/null +++ b/tests/3_lis/outputs_gemini/gemini-3-pro-preview TEMP_0.8.js @@ -0,0 +1,7 @@ +const findLISLength = async nums => { + const { bisectLeft: search } = await import('https://cdn.jsdelivr.net/npm/d3-array@3/+esm') + const tails = [] + for (const n of nums) tails[search(tails, n)] = n + return tails.length +} +export default findLISLength; \ No newline at end of file diff --git a/tests/3_lis/outputs_gemini/gemini-3-pro-preview TEMP_0.9.js b/tests/3_lis/outputs_gemini/gemini-3-pro-preview TEMP_0.9.js new file mode 100644 index 0000000..ba40fa8 --- /dev/null +++ b/tests/3_lis/outputs_gemini/gemini-3-pro-preview TEMP_0.9.js @@ -0,0 +1,7 @@ +const findLISLength = async n => { + const { bisectLeft: b } = await import('https://cdn.jsdelivr.net/npm/d3-array@3/+esm') + const t = [] + for (const x of n) t[b(t, x)] = x + return t.length +} +export default findLISLength; \ No newline at end of file diff --git a/tests/3_lis/outputs_gemini/gemini-3-pro-preview TEMP_0.js b/tests/3_lis/outputs_gemini/gemini-3-pro-preview TEMP_0.js new file mode 100644 index 0000000..743e706 --- /dev/null +++ b/tests/3_lis/outputs_gemini/gemini-3-pro-preview TEMP_0.js @@ -0,0 +1,11 @@ +const findLISLength = async (nums) => { + if (!nums?.length) return 0 + const { bisectLeft } = await import('https://cdn.jsdelivr.net/npm/d3-array@3/+esm') + const tails = [] + for (const x of nums) { + const i = bisectLeft(tails, x) + i < tails.length ? tails[i] = x : tails.push(x) + } + return tails.length +} +export default findLISLength; \ No newline at end of file diff --git a/tests/3_lis/outputs_gemini/gemini-3-pro-preview TEMP_1.1.js b/tests/3_lis/outputs_gemini/gemini-3-pro-preview TEMP_1.1.js new file mode 100644 index 0000000..af73b89 --- /dev/null +++ b/tests/3_lis/outputs_gemini/gemini-3-pro-preview TEMP_1.1.js @@ -0,0 +1,7 @@ +const findLISLength = async a => { + const { bisectLeft: b } = await import('https://cdn.jsdelivr.net/npm/d3-array@3/+esm') + const t = [] + for (const n of a) t[b(t, n)] = n + return t.length +} +export default findLISLength; \ No newline at end of file diff --git a/tests/3_lis/outputs_gemini/gemini-3-pro-preview TEMP_1.js b/tests/3_lis/outputs_gemini/gemini-3-pro-preview TEMP_1.js new file mode 100644 index 0000000..866a044 --- /dev/null +++ b/tests/3_lis/outputs_gemini/gemini-3-pro-preview TEMP_1.js @@ -0,0 +1,9 @@ +const findLISLength = async nums => { + const { bisectLeft } = await import('https://esm.sh/d3-array') + const sub = [] + for (const n of nums) { + sub[bisectLeft(sub, n)] = n + } + return sub.length +} +export default findLISLength; \ No newline at end of file diff --git a/tests/4_determinant/outputs_gemini/gemini-3-pro-preview TEMP_0.1.js b/tests/4_determinant/outputs_gemini/gemini-3-pro-preview TEMP_0.1.js new file mode 100644 index 0000000..752ccfd --- /dev/null +++ b/tests/4_determinant/outputs_gemini/gemini-3-pro-preview TEMP_0.1.js @@ -0,0 +1,4 @@ +const calculateDeterminant = async m => + (await import('https://cdn.jsdelivr.net/npm/mathjs@12/+esm')) + .det(m) +export default calculateDeterminant; \ No newline at end of file diff --git a/tests/4_determinant/outputs_gemini/gemini-3-pro-preview TEMP_0.2.js b/tests/4_determinant/outputs_gemini/gemini-3-pro-preview TEMP_0.2.js new file mode 100644 index 0000000..cb1fdbb --- /dev/null +++ b/tests/4_determinant/outputs_gemini/gemini-3-pro-preview TEMP_0.2.js @@ -0,0 +1,4 @@ +const calculateDeterminant = async m => + (await import('https://esm.sh/mathjs')) + .det(m) +export default calculateDeterminant; \ No newline at end of file diff --git a/tests/4_determinant/outputs_gemini/gemini-3-pro-preview TEMP_0.3.js b/tests/4_determinant/outputs_gemini/gemini-3-pro-preview TEMP_0.3.js new file mode 100644 index 0000000..76c0957 --- /dev/null +++ b/tests/4_determinant/outputs_gemini/gemini-3-pro-preview TEMP_0.3.js @@ -0,0 +1,4 @@ +const calculateDeterminant = async m => + (await import('https://cdn.jsdelivr.net/npm/mathjs/+esm')) + .det(m) +export default calculateDeterminant; \ No newline at end of file diff --git a/tests/4_determinant/outputs_gemini/gemini-3-pro-preview TEMP_0.4.js b/tests/4_determinant/outputs_gemini/gemini-3-pro-preview TEMP_0.4.js new file mode 100644 index 0000000..2d831e5 --- /dev/null +++ b/tests/4_determinant/outputs_gemini/gemini-3-pro-preview TEMP_0.4.js @@ -0,0 +1,5 @@ +const calculateDeterminant = async m => { + const { det } = await import('https://esm.sh/mathjs@12') + return det(m) +} +export default calculateDeterminant; \ No newline at end of file diff --git a/tests/4_determinant/outputs_gemini/gemini-3-pro-preview TEMP_0.5.js b/tests/4_determinant/outputs_gemini/gemini-3-pro-preview TEMP_0.5.js new file mode 100644 index 0000000..146821a --- /dev/null +++ b/tests/4_determinant/outputs_gemini/gemini-3-pro-preview TEMP_0.5.js @@ -0,0 +1,5 @@ +const calculateDeterminant = async m => { + const { det } = await import('https://cdn.jsdelivr.net/npm/mathjs@12/+esm') + return det(m) +} +export default calculateDeterminant; \ No newline at end of file diff --git a/tests/4_determinant/outputs_gemini/gemini-3-pro-preview TEMP_0.6.js b/tests/4_determinant/outputs_gemini/gemini-3-pro-preview TEMP_0.6.js new file mode 100644 index 0000000..84bcba8 --- /dev/null +++ b/tests/4_determinant/outputs_gemini/gemini-3-pro-preview TEMP_0.6.js @@ -0,0 +1,5 @@ +const calculateDeterminant = async m => { + const { det } = await import('https://esm.sh/mathjs') + return det(m) +} +export default calculateDeterminant; \ No newline at end of file diff --git a/tests/4_determinant/outputs_gemini/gemini-3-pro-preview TEMP_0.7.js b/tests/4_determinant/outputs_gemini/gemini-3-pro-preview TEMP_0.7.js new file mode 100644 index 0000000..2d831e5 --- /dev/null +++ b/tests/4_determinant/outputs_gemini/gemini-3-pro-preview TEMP_0.7.js @@ -0,0 +1,5 @@ +const calculateDeterminant = async m => { + const { det } = await import('https://esm.sh/mathjs@12') + return det(m) +} +export default calculateDeterminant; \ No newline at end of file diff --git a/tests/4_determinant/outputs_gemini/gemini-3-pro-preview TEMP_0.8.js b/tests/4_determinant/outputs_gemini/gemini-3-pro-preview TEMP_0.8.js new file mode 100644 index 0000000..2d831e5 --- /dev/null +++ b/tests/4_determinant/outputs_gemini/gemini-3-pro-preview TEMP_0.8.js @@ -0,0 +1,5 @@ +const calculateDeterminant = async m => { + const { det } = await import('https://esm.sh/mathjs@12') + return det(m) +} +export default calculateDeterminant; \ No newline at end of file diff --git a/tests/4_determinant/outputs_gemini/gemini-3-pro-preview TEMP_0.9.js b/tests/4_determinant/outputs_gemini/gemini-3-pro-preview TEMP_0.9.js new file mode 100644 index 0000000..84bcba8 --- /dev/null +++ b/tests/4_determinant/outputs_gemini/gemini-3-pro-preview TEMP_0.9.js @@ -0,0 +1,5 @@ +const calculateDeterminant = async m => { + const { det } = await import('https://esm.sh/mathjs') + return det(m) +} +export default calculateDeterminant; \ No newline at end of file diff --git a/tests/4_determinant/outputs_gemini/gemini-3-pro-preview TEMP_0.js b/tests/4_determinant/outputs_gemini/gemini-3-pro-preview TEMP_0.js new file mode 100644 index 0000000..752ccfd --- /dev/null +++ b/tests/4_determinant/outputs_gemini/gemini-3-pro-preview TEMP_0.js @@ -0,0 +1,4 @@ +const calculateDeterminant = async m => + (await import('https://cdn.jsdelivr.net/npm/mathjs@12/+esm')) + .det(m) +export default calculateDeterminant; \ No newline at end of file diff --git a/tests/4_determinant/outputs_gemini/gemini-3-pro-preview TEMP_1.1.js b/tests/4_determinant/outputs_gemini/gemini-3-pro-preview TEMP_1.1.js new file mode 100644 index 0000000..e72123e --- /dev/null +++ b/tests/4_determinant/outputs_gemini/gemini-3-pro-preview TEMP_1.1.js @@ -0,0 +1,5 @@ +const calculateDeterminant = async m => { + const { det } = await import('https://esm.sh/mathjs@13.0.0') + return det(m) +} +export default calculateDeterminant; \ No newline at end of file diff --git a/tests/4_determinant/outputs_gemini/gemini-3-pro-preview TEMP_1.js b/tests/4_determinant/outputs_gemini/gemini-3-pro-preview TEMP_1.js new file mode 100644 index 0000000..b294f8b --- /dev/null +++ b/tests/4_determinant/outputs_gemini/gemini-3-pro-preview TEMP_1.js @@ -0,0 +1,5 @@ +const calculateDeterminant = async m => { + const { det } = await import('https://cdn.jsdelivr.net/npm/mathjs/+esm') + return det(m) +} +export default calculateDeterminant; \ No newline at end of file diff --git a/tests/5_markdown_parser/outputs_gemini/gemini-3-pro-preview TEMP_0.1.js b/tests/5_markdown_parser/outputs_gemini/gemini-3-pro-preview TEMP_0.1.js new file mode 100644 index 0000000..9fd9d4c --- /dev/null +++ b/tests/5_markdown_parser/outputs_gemini/gemini-3-pro-preview TEMP_0.1.js @@ -0,0 +1,5 @@ +const parseMarkdown = async t => { + const { parse } = await import('https://esm.sh/marked') + return parse(t ?? '') +} +export default parseMarkdown; \ No newline at end of file diff --git a/tests/5_markdown_parser/outputs_gemini/gemini-3-pro-preview TEMP_0.2.js b/tests/5_markdown_parser/outputs_gemini/gemini-3-pro-preview TEMP_0.2.js new file mode 100644 index 0000000..2766dea --- /dev/null +++ b/tests/5_markdown_parser/outputs_gemini/gemini-3-pro-preview TEMP_0.2.js @@ -0,0 +1,5 @@ +const parseMarkdown = async s => { + const { parse } = await import('https://esm.sh/marked@12.0.1') + return parse(s) +} +export default parseMarkdown; \ No newline at end of file diff --git a/tests/5_markdown_parser/outputs_gemini/gemini-3-pro-preview TEMP_0.3.js b/tests/5_markdown_parser/outputs_gemini/gemini-3-pro-preview TEMP_0.3.js new file mode 100644 index 0000000..6ae9870 --- /dev/null +++ b/tests/5_markdown_parser/outputs_gemini/gemini-3-pro-preview TEMP_0.3.js @@ -0,0 +1,5 @@ +const parseMarkdown = async md => { + const { parse } = await import('https://esm.sh/marked@12.0.1') + return parse(md) +} +export default parseMarkdown; \ No newline at end of file diff --git a/tests/5_markdown_parser/outputs_gemini/gemini-3-pro-preview TEMP_0.4.js b/tests/5_markdown_parser/outputs_gemini/gemini-3-pro-preview TEMP_0.4.js new file mode 100644 index 0000000..460483f --- /dev/null +++ b/tests/5_markdown_parser/outputs_gemini/gemini-3-pro-preview TEMP_0.4.js @@ -0,0 +1,5 @@ +const parseMarkdown = async m => ( + (await import('https://esm.sh/marked@12.0.0')) + .parse(m) +) +export default parseMarkdown; \ No newline at end of file diff --git a/tests/5_markdown_parser/outputs_gemini/gemini-3-pro-preview TEMP_0.5.js b/tests/5_markdown_parser/outputs_gemini/gemini-3-pro-preview TEMP_0.5.js new file mode 100644 index 0000000..89e5bee --- /dev/null +++ b/tests/5_markdown_parser/outputs_gemini/gemini-3-pro-preview TEMP_0.5.js @@ -0,0 +1,5 @@ +const parseMarkdown = async md => { + const { marked } = await import('https://cdn.jsdelivr.net/npm/marked@12.0.1/lib/marked.esm.js') + return marked.parse(md) +} +export default parseMarkdown; \ No newline at end of file diff --git a/tests/5_markdown_parser/outputs_gemini/gemini-3-pro-preview TEMP_0.6.js b/tests/5_markdown_parser/outputs_gemini/gemini-3-pro-preview TEMP_0.6.js new file mode 100644 index 0000000..da8577e --- /dev/null +++ b/tests/5_markdown_parser/outputs_gemini/gemini-3-pro-preview TEMP_0.6.js @@ -0,0 +1,7 @@ +let parser + +const parseMarkdown = async (md) => { + parser ??= (await import('https://cdn.jsdelivr.net/npm/marked/+esm')).parse + return parser(md) +} +export default parseMarkdown; \ No newline at end of file diff --git a/tests/5_markdown_parser/outputs_gemini/gemini-3-pro-preview TEMP_0.7.js b/tests/5_markdown_parser/outputs_gemini/gemini-3-pro-preview TEMP_0.7.js new file mode 100644 index 0000000..9e3efc0 --- /dev/null +++ b/tests/5_markdown_parser/outputs_gemini/gemini-3-pro-preview TEMP_0.7.js @@ -0,0 +1,5 @@ +const parseMarkdown = async md => { + const { parse } = await import('https://cdn.jsdelivr.net/npm/marked@12/+esm') + return parse(md) +} +export default parseMarkdown; \ No newline at end of file diff --git a/tests/5_markdown_parser/outputs_gemini/gemini-3-pro-preview TEMP_0.8.js b/tests/5_markdown_parser/outputs_gemini/gemini-3-pro-preview TEMP_0.8.js new file mode 100644 index 0000000..7ab6846 --- /dev/null +++ b/tests/5_markdown_parser/outputs_gemini/gemini-3-pro-preview TEMP_0.8.js @@ -0,0 +1,5 @@ +const parseMarkdown = async s => { + const { parse } = await import('https://esm.sh/marked@12.0.2') + return parse(s + '') +} +export default parseMarkdown; \ No newline at end of file diff --git a/tests/5_markdown_parser/outputs_gemini/gemini-3-pro-preview TEMP_0.9.js b/tests/5_markdown_parser/outputs_gemini/gemini-3-pro-preview TEMP_0.9.js new file mode 100644 index 0000000..851491f --- /dev/null +++ b/tests/5_markdown_parser/outputs_gemini/gemini-3-pro-preview TEMP_0.9.js @@ -0,0 +1,5 @@ +const parseMarkdown = async (md) => { + const { parse } = await import('https://cdn.jsdelivr.net/npm/marked@12.0.2/+esm') + return parse(md) +} +export default parseMarkdown; \ No newline at end of file diff --git a/tests/5_markdown_parser/outputs_gemini/gemini-3-pro-preview TEMP_0.js b/tests/5_markdown_parser/outputs_gemini/gemini-3-pro-preview TEMP_0.js new file mode 100644 index 0000000..5eb70cf --- /dev/null +++ b/tests/5_markdown_parser/outputs_gemini/gemini-3-pro-preview TEMP_0.js @@ -0,0 +1,9 @@ +const parseMarkdown = async t => { + const u = 'https://esm.sh/', + [{ parse }, { default: d }] = await Promise.all([ + import(u + 'marked@12.0.1'), + import(u + 'dompurify@3.0.9') + ]) + return d(self).sanitize(parse(t ?? '')) +} +export default parseMarkdown; \ No newline at end of file diff --git a/tests/5_markdown_parser/outputs_gemini/gemini-3-pro-preview TEMP_1.1.js b/tests/5_markdown_parser/outputs_gemini/gemini-3-pro-preview TEMP_1.1.js new file mode 100644 index 0000000..26b0bf4 --- /dev/null +++ b/tests/5_markdown_parser/outputs_gemini/gemini-3-pro-preview TEMP_1.1.js @@ -0,0 +1,9 @@ +const parseMarkdown = async t => { + const { parse: p } = await import('https://esm.sh/marked@12') + return p(t, { + async: false, + breaks: true, + gfm: true + }) +} +export default parseMarkdown; \ No newline at end of file diff --git a/tests/5_markdown_parser/outputs_gemini/gemini-3-pro-preview TEMP_1.js b/tests/5_markdown_parser/outputs_gemini/gemini-3-pro-preview TEMP_1.js new file mode 100644 index 0000000..a87c9a4 --- /dev/null +++ b/tests/5_markdown_parser/outputs_gemini/gemini-3-pro-preview TEMP_1.js @@ -0,0 +1,4 @@ +const parseMarkdown = async s => + (await import('https://cdn.jsdelivr.net/npm/marked/+esm')) + .parse(s) +export default parseMarkdown; \ No newline at end of file diff --git a/tests/6_csv_processor/outputs_gemini/gemini-3-pro-preview TEMP_0.1.js b/tests/6_csv_processor/outputs_gemini/gemini-3-pro-preview TEMP_0.1.js new file mode 100644 index 0000000..3adcde9 --- /dev/null +++ b/tests/6_csv_processor/outputs_gemini/gemini-3-pro-preview TEMP_0.1.js @@ -0,0 +1,18 @@ +const processCSV = async (csv, { filterColumn: fc, filterValue: fv, groupBy: gb, aggregateColumn: ac, operation: op }) => { + const { parse } = (await import('https://cdn.jsdelivr.net/npm/papaparse@5.4.1/+esm')).default + const { data } = parse(csv, { header: true, skipEmptyLines: true }) + + return Object.entries(data.reduce((a, r) => { + if (r[fc] == fv) { + const k = r[gb], v = +r[ac] || 0 + a[k] ??= { s: 0, c: 0 } + a[k].s += v + a[k].c++ + } + return a + }, {})).map(([k, { s, c }]) => ({ + [gb]: k, + result: op === 'count' ? c : op === 'avg' ? s / c : s + })) +} +export default processCSV; \ No newline at end of file diff --git a/tests/6_csv_processor/outputs_gemini/gemini-3-pro-preview TEMP_0.2.js b/tests/6_csv_processor/outputs_gemini/gemini-3-pro-preview TEMP_0.2.js new file mode 100644 index 0000000..4bf5afe --- /dev/null +++ b/tests/6_csv_processor/outputs_gemini/gemini-3-pro-preview TEMP_0.2.js @@ -0,0 +1,17 @@ +export const processCSV = async (str, { filterColumn: fc, filterValue: fv, groupBy: gb, aggregateColumn: ac, operation: op }) => { + const [{ parse }, { filter, groupBy, map, sum }] = await Promise.all([ + import('https://cdn.jsdelivr.net/npm/papaparse@5.4.1/+esm'), + import('https://cdn.jsdelivr.net/npm/lodash-es@4.17.21/+esm') + ]) + + const { data } = parse(str, { header: true, skipEmptyLines: true }) + const rows = filter(data, r => r[fc] == fv) + + return map(groupBy(rows, gb), (group, key) => { + const vals = map(group, r => +r[ac] || 0) + const total = sum(vals) + const res = op === 'count' ? group.length : op === 'sum' ? total : total / group.length + return { [gb]: key, result: res } + }) +} +export default processCSV; \ No newline at end of file diff --git a/tests/6_csv_processor/outputs_gemini/gemini-3-pro-preview TEMP_0.3.js b/tests/6_csv_processor/outputs_gemini/gemini-3-pro-preview TEMP_0.3.js new file mode 100644 index 0000000..222228d --- /dev/null +++ b/tests/6_csv_processor/outputs_gemini/gemini-3-pro-preview TEMP_0.3.js @@ -0,0 +1,18 @@ +const processCSV = async (csvString, { filterColumn, filterValue, groupBy, aggregateColumn, operation }) => { + const [{ csvParse }, { rollup, sum, mean }] = await Promise.all([ + import('https://cdn.jsdelivr.net/npm/d3-dsv@3/+esm'), + import('https://cdn.jsdelivr.net/npm/d3-array@3/+esm') + ]); + + const getValue = d => +d[aggregateColumn] || 0; + const data = csvParse(csvString).filter(d => d[filterColumn] == filterValue); + + const aggregated = rollup( + data, + g => operation === 'count' ? g.length : (operation === 'sum' ? sum : mean)(g, getValue), + d => d[groupBy] + ); + + return Array.from(aggregated, ([key, result]) => ({ [groupBy]: key, result })); +}; +export default processCSV; \ No newline at end of file diff --git a/tests/6_csv_processor/outputs_gemini/gemini-3-pro-preview TEMP_0.4.js b/tests/6_csv_processor/outputs_gemini/gemini-3-pro-preview TEMP_0.4.js new file mode 100644 index 0000000..5ec8f08 --- /dev/null +++ b/tests/6_csv_processor/outputs_gemini/gemini-3-pro-preview TEMP_0.4.js @@ -0,0 +1,22 @@ +const processCSV = async (csvString, { filterColumn: fc, filterValue: fv, groupBy: gb, aggregateColumn: ac, operation: op }) => { + const { parse } = await import('https://cdn.jsdelivr.net/npm/papaparse@5.4.1/+esm') + const { data } = parse(csvString, { header: true, skipEmptyLines: true }) + const groups = new Map() + + for (const row of data) { + if (row[fc] == fv) { + const key = row[gb] + const val = +row[ac] || 0 + const acc = groups.get(key) || { sum: 0, count: 0 } + acc.sum += val + acc.count += 1 + groups.set(key, acc) + } + } + + return Array.from(groups, ([key, { sum, count }]) => ({ + [gb]: key, + result: op === 'count' ? count : op === 'sum' ? sum : sum / count + })) +} +export default processCSV; \ No newline at end of file diff --git a/tests/6_csv_processor/outputs_gemini/gemini-3-pro-preview TEMP_0.5.js b/tests/6_csv_processor/outputs_gemini/gemini-3-pro-preview TEMP_0.5.js new file mode 100644 index 0000000..771b07f --- /dev/null +++ b/tests/6_csv_processor/outputs_gemini/gemini-3-pro-preview TEMP_0.5.js @@ -0,0 +1,18 @@ +const processCSV = async (csv, { filterColumn: fc, filterValue: fv, groupBy: gb, aggregateColumn: ac, operation: op }) => { + const [{ default: Papa }, { default: _ }] = await Promise.all([ + import('https://esm.sh/papaparse@5.4.1'), + import('https://esm.sh/lodash@4.17.21') + ]) + + const { data } = Papa.parse(csv, { header: true, skipEmptyLines: true }) + + return _.map(_.groupBy(_.filter(data, r => r[fc] == fv), gb), (rows, k) => { + const vals = rows.map(r => +r[ac] || 0) + const sum = _.sum(vals) + return { + [gb]: k, + result: op === 'count' ? vals.length : op === 'sum' ? sum : sum / vals.length + } + }) +} +export default processCSV; \ No newline at end of file diff --git a/tests/6_csv_processor/outputs_gemini/gemini-3-pro-preview TEMP_0.6.js b/tests/6_csv_processor/outputs_gemini/gemini-3-pro-preview TEMP_0.6.js new file mode 100644 index 0000000..fb23459 --- /dev/null +++ b/tests/6_csv_processor/outputs_gemini/gemini-3-pro-preview TEMP_0.6.js @@ -0,0 +1,20 @@ +const processCSV = async (csv, { filterColumn: fc, filterValue: fv, groupBy: gb, aggregateColumn: ac, operation: op }) => { + const { default: Papa } = await import('https://cdn.jsdelivr.net/npm/papaparse@5.4.1/+esm') + const { data } = Papa.parse(csv, { header: true, skipEmptyLines: true }) + + const groups = data.reduce((acc, row) => { + if (row[fc] == fv) { + const k = row[gb], v = +row[ac] || 0 + acc[k] = acc[k] || { s: 0, c: 0 } + acc[k].s += v + acc[k].c++ + } + return acc + }, {}) + + return Object.entries(groups).map(([k, { s, c }]) => ({ + [gb]: k, + result: op === 'count' ? c : op === 'avg' ? s / c : s + })) +} +export default processCSV; \ No newline at end of file diff --git a/tests/6_csv_processor/outputs_gemini/gemini-3-pro-preview TEMP_0.7.js b/tests/6_csv_processor/outputs_gemini/gemini-3-pro-preview TEMP_0.7.js new file mode 100644 index 0000000..89ef65f --- /dev/null +++ b/tests/6_csv_processor/outputs_gemini/gemini-3-pro-preview TEMP_0.7.js @@ -0,0 +1,18 @@ +const processCSV = async (csv, cfg) => { + const [{default: P}, {default: _}] = await Promise.all([ + import('https://cdn.jsdelivr.net/npm/papaparse@5.4.1/+esm'), + import('https://cdn.jsdelivr.net/npm/lodash@4.17.21/+esm') + ]); + + const {data} = P.parse(csv, {header: true, skipEmptyLines: true}); + const {filterColumn: fc, filterValue: fv, groupBy: gb, aggregateColumn: ac, operation: op} = cfg; + + return _.map(_.groupBy(_.filter(data, r => r[fc] == fv), gb), (rows, key) => { + const vals = rows.map(r => +r[ac] || 0), sum = _.sum(vals); + return { + [gb]: key, + result: op === 'count' ? vals.length : op === 'sum' ? sum : sum / vals.length + }; + }); +}; +export default processCSV; \ No newline at end of file diff --git a/tests/6_csv_processor/outputs_gemini/gemini-3-pro-preview TEMP_0.8.js b/tests/6_csv_processor/outputs_gemini/gemini-3-pro-preview TEMP_0.8.js new file mode 100644 index 0000000..2e93bab --- /dev/null +++ b/tests/6_csv_processor/outputs_gemini/gemini-3-pro-preview TEMP_0.8.js @@ -0,0 +1,21 @@ +const processCSV = async (csvString, config) => { + const { parse } = await import('https://cdn.jsdelivr.net/npm/papaparse@5.4.1/+esm'); + const { filterColumn: fc, filterValue: fv, groupBy: gb, aggregateColumn: ac, operation: op } = config; + const acc = {}; + + parse(csvString, { header: true, skipEmptyLines: true }).data.forEach(row => { + if (row[fc] == fv) { + const key = row[gb]; + const val = +row[ac] || 0; + const entry = acc[key] ??= { sum: 0, count: 0 }; + entry.sum += val; + entry.count++; + } + }); + + return Object.entries(acc).map(([key, { sum, count }]) => ({ + [gb]: key, + result: op === 'avg' ? sum / count : op === 'count' ? count : sum + })); +}; +export default processCSV; \ No newline at end of file diff --git a/tests/6_csv_processor/outputs_gemini/gemini-3-pro-preview TEMP_0.9.js b/tests/6_csv_processor/outputs_gemini/gemini-3-pro-preview TEMP_0.9.js new file mode 100644 index 0000000..7797389 --- /dev/null +++ b/tests/6_csv_processor/outputs_gemini/gemini-3-pro-preview TEMP_0.9.js @@ -0,0 +1,20 @@ +const processCSV = async (csvStr, { filterColumn: fc, filterValue: fv, groupBy: gb, aggregateColumn: ac, operation: op }) => { + const { csvParse } = await import('https://esm.sh/d3-dsv@3'); + + const groups = csvParse(csvStr).reduce((acc, row) => { + if (row[fc] == fv) { + const key = row[gb], val = +row[ac] || 0; + const entry = acc.get(key) || { s: 0, c: 0 }; + entry.s += val; + entry.c++; + acc.set(key, entry); + } + return acc; + }, new Map()); + + return Array.from(groups, ([key, { s, c }]) => ({ + [gb]: key, + result: op === 'count' ? c : op === 'sum' ? s : s / c + })); +}; +export default processCSV; \ No newline at end of file diff --git a/tests/6_csv_processor/outputs_gemini/gemini-3-pro-preview TEMP_0.js b/tests/6_csv_processor/outputs_gemini/gemini-3-pro-preview TEMP_0.js new file mode 100644 index 0000000..0ac5140 --- /dev/null +++ b/tests/6_csv_processor/outputs_gemini/gemini-3-pro-preview TEMP_0.js @@ -0,0 +1,13 @@ +export const processCSV = async (csv, { filterColumn: fc, filterValue: fv, groupBy: gb, aggregateColumn: ac, operation: op }) => { + const { csvParse, rollups, sum } = await import('https://cdn.jsdelivr.net/npm/d3@7/+esm') + + return rollups( + csvParse(csv).filter(d => d[fc] == fv), + g => { + const s = sum(g, d => +d[ac] || 0) + return op === 'count' ? g.length : op === 'sum' ? s : s / g.length + }, + d => d[gb] + ).map(([k, v]) => ({ [gb]: k, result: v })) +} +export default processCSV; \ No newline at end of file diff --git a/tests/6_csv_processor/outputs_gemini/gemini-3-pro-preview TEMP_1.1.js b/tests/6_csv_processor/outputs_gemini/gemini-3-pro-preview TEMP_1.1.js new file mode 100644 index 0000000..9dfd98a --- /dev/null +++ b/tests/6_csv_processor/outputs_gemini/gemini-3-pro-preview TEMP_1.1.js @@ -0,0 +1,21 @@ +const processCSV = async (csvString, config) => { + const { csvParse } = await import('https://esm.sh/d3-dsv@3'); + const { filterColumn: fc, filterValue: fv, groupBy: gb, aggregateColumn: ac, operation: op } = config; + + const groups = csvParse(csvString).reduce((acc, row) => { + if (row[fc] == fv) { + const key = row[gb]; + const val = +row[ac] || 0; + acc[key] = acc[key] || { sum: 0, count: 0 }; + acc[key].sum += val; + acc[key].count++; + } + return acc; + }, {}); + + return Object.entries(groups).map(([key, { sum, count }]) => ({ + [gb]: key, + result: op === 'avg' ? sum / count : op === 'count' ? count : sum + })); +}; +export default processCSV; \ No newline at end of file diff --git a/tests/6_csv_processor/outputs_gemini/gemini-3-pro-preview TEMP_1.js b/tests/6_csv_processor/outputs_gemini/gemini-3-pro-preview TEMP_1.js new file mode 100644 index 0000000..9143e19 --- /dev/null +++ b/tests/6_csv_processor/outputs_gemini/gemini-3-pro-preview TEMP_1.js @@ -0,0 +1,21 @@ +const processCSV = async (csv, cfg) => { + const { default: Papa } = await import('https://cdn.jsdelivr.net/npm/papaparse@5.4.1/+esm'); + const { filterColumn: fc, filterValue: fv, groupBy: gb, aggregateColumn: ac, operation: op } = cfg; + + const grouped = Papa.parse(csv, { header: true, skipEmptyLines: true }).data.reduce((acc, row) => { + if (row[fc] == fv) { + const key = row[gb]; + const val = +row[ac] || 0; + acc[key] = acc[key] || { sum: 0, count: 0 }; + acc[key].sum += val; + acc[key].count++; + } + return acc; + }, {}); + + return Object.entries(grouped).map(([key, { sum, count }]) => ({ + [gb]: key, + result: op === 'count' ? count : op === 'avg' ? sum / count : sum + })); +}; +export default processCSV; \ No newline at end of file diff --git a/tests/7_scheduler/outputs_gemini/gemini-3-pro-preview TEMP_0.1.js b/tests/7_scheduler/outputs_gemini/gemini-3-pro-preview TEMP_0.1.js new file mode 100644 index 0000000..7f6fe55 --- /dev/null +++ b/tests/7_scheduler/outputs_gemini/gemini-3-pro-preview TEMP_0.1.js @@ -0,0 +1,48 @@ +const findAvailableSlots = async (calA, calB, { durationMinutes: dur, searchRange: rng, workHours: wh }) => { + const [djs, utc] = await Promise.all([ + import('https://esm.sh/dayjs@1.11.10'), + import('https://esm.sh/dayjs@1.11.10/plugin/utc') + ]).then(m => m.map(i => i.default)); + + djs.extend(utc); + const U = (d) => djs(d).utc(); + const [wsH, wsM] = wh.start.split(':').map(Number); + const [weH, weM] = wh.end.split(':').map(Number); + + const busy = [...calA, ...calB] + .map(s => ({ s: U(s.start), e: U(s.end) })) + .sort((a, b) => a.s - b.s) + .reduce((acc, c) => { + const last = acc[acc.length - 1]; + if (last && c.s.diff(last.e) < 0) last.e = c.e.diff(last.e) > 0 ? c.e : last.e; + else acc.push(c); + return acc; + }, []); + + const slots = []; + let curDay = U(rng.start).startOf('day'); + const limit = U(rng.end); + + while (curDay.isBefore(limit)) { + let wStart = curDay.hour(wsH).minute(wsM); + let wEnd = curDay.hour(weH).minute(weM); + + if (wStart.isBefore(U(rng.start))) wStart = U(rng.start); + if (wEnd.isAfter(limit)) wEnd = limit; + + let ptr = wStart; + while (ptr.add(dur, 'm').diff(wEnd) <= 0) { + const next = ptr.add(dur, 'm'); + const clash = busy.find(b => ptr.isBefore(b.e) && next.isAfter(b.s)); + + if (clash) ptr = clash.e; + else { + slots.push({ start: ptr.format(), end: next.format() }); + ptr = next; + } + } + curDay = curDay.add(1, 'day'); + } + return slots; +}; +export default findAvailableSlots; \ No newline at end of file diff --git a/tests/7_scheduler/outputs_gemini/gemini-3-pro-preview TEMP_0.2.js b/tests/7_scheduler/outputs_gemini/gemini-3-pro-preview TEMP_0.2.js new file mode 100644 index 0000000..8abc2db --- /dev/null +++ b/tests/7_scheduler/outputs_gemini/gemini-3-pro-preview TEMP_0.2.js @@ -0,0 +1,44 @@ +const findAvailableSlots = async (calA, calB, { durationMinutes: dur, searchRange: rng, workHours: wh }) => { + const { DateTime: DT, Interval: IV } = await import('https://cdn.jsdelivr.net/npm/luxon@3.4.4/+esm'); + const z = { zone: 'utc' }, parse = s => DT.fromISO(s, z); + const range = IV.fromDateTimes(parse(rng.start), parse(rng.end)); + + const busy = [...calA, ...calB] + .map(s => IV.fromDateTimes(parse(s.start), parse(s.end))) + .filter(i => i.isValid) + .sort((a, b) => a.start - b.start); + + const merged = busy.reduce((acc, curr) => { + const last = acc[acc.length - 1]; + if (last && (last.overlaps(curr) || last.abutsStart(curr))) { + acc[acc.length - 1] = last.union(curr); + } else acc.push(curr); + return acc; + }, []); + + const slots = []; + let day = range.start.startOf('day'); + const [sH, sM] = wh.start.split(':'), [eH, eM] = wh.end.split(':'); + + while (day < range.end) { + const wStart = day.set({ hour: sH, minute: sM }), wEnd = day.set({ hour: eH, minute: eM }); + let work = IV.fromDateTimes(wStart, wEnd).intersection(range); + + if (work && work.isValid) { + let cursor = work.start; + while (cursor < work.end) { + const block = merged.find(b => b.end > cursor && b.start < work.end); + const limit = (block && block.start < work.end) ? block.start : work.end; + + while (cursor.plus({ minutes: dur }) <= limit) { + slots.push({ start: cursor.toISO(), end: cursor.plus({ minutes: dur }).toISO() }); + cursor = cursor.plus({ minutes: dur }); + } + cursor = block ? (block.end > cursor ? block.end : cursor) : work.end; + } + } + day = day.plus({ days: 1 }); + } + return slots; +}; +export default findAvailableSlots; \ No newline at end of file diff --git a/tests/7_scheduler/outputs_gemini/gemini-3-pro-preview TEMP_0.3.js b/tests/7_scheduler/outputs_gemini/gemini-3-pro-preview TEMP_0.3.js new file mode 100644 index 0000000..762cc66 --- /dev/null +++ b/tests/7_scheduler/outputs_gemini/gemini-3-pro-preview TEMP_0.3.js @@ -0,0 +1,55 @@ +export const findAvailableSlots = async (calendarA, calendarB, { durationMinutes, searchRange, workHours }) => { + const { default: dayjs } = await import('https://esm.sh/dayjs'); + const { default: utc } = await import('https://esm.sh/dayjs/plugin/utc'); + dayjs.extend(utc); + + const parse = (d) => dayjs.utc(d); + const msDuration = durationMinutes * 60000; + const rangeStart = parse(searchRange.start); + const rangeEnd = parse(searchRange.end); + + let busy = [...calendarA, ...calendarB] + .map(s => ({ s: parse(s.start).valueOf(), e: parse(s.end).valueOf() })) + .sort((a, b) => a.s - b.s) + .reduce((acc, curr) => { + const last = acc[acc.length - 1]; + if (last && curr.s < last.e) last.e = Math.max(last.e, curr.e); + else acc.push(curr); + return acc; + }, []); + + const slots = []; + let currentDay = rangeStart.startOf('day'); + const finalDay = rangeEnd.endOf('day'); + + while (currentDay.isBefore(finalDay) || currentDay.isSame(finalDay)) { + const dateStr = currentDay.format('YYYY-MM-DD'); + let start = parse(`${dateStr}T${workHours.start}`); + let end = parse(`${dateStr}T${workHours.end}`); + + if (start.isBefore(rangeStart)) start = rangeStart; + if (end.isAfter(rangeEnd)) end = rangeEnd; + + let ptr = start.valueOf(); + const limit = end.valueOf(); + + while (ptr + msDuration <= limit) { + const slotEnd = ptr + msDuration; + const conflict = busy.find(b => b.s < slotEnd && b.e > ptr); + + if (conflict) { + ptr = conflict.e; + } else { + slots.push({ + start: dayjs(ptr).utc().format(), + end: dayjs(slotEnd).utc().format() + }); + ptr += msDuration; + } + } + currentDay = currentDay.add(1, 'day'); + } + + return slots; +}; +export default findAvailableSlots; \ No newline at end of file diff --git a/tests/7_scheduler/outputs_gemini/gemini-3-pro-preview TEMP_0.4.js b/tests/7_scheduler/outputs_gemini/gemini-3-pro-preview TEMP_0.4.js new file mode 100644 index 0000000..d8f6bbd --- /dev/null +++ b/tests/7_scheduler/outputs_gemini/gemini-3-pro-preview TEMP_0.4.js @@ -0,0 +1,44 @@ +export const findAvailableSlots = async (calA, calB, { durationMinutes: dur, searchRange, workHours }) => { + const { DateTime, Interval } = await import('https://esm.sh/luxon@3.4.4'); + const utc = (t) => DateTime.fromISO(t, { zone: 'utc' }); + const bounds = Interval.fromDateTimes(utc(searchRange.start), utc(searchRange.end)); + + const busy = [...calA, ...calB] + .map(s => Interval.fromDateTimes(utc(s.start), utc(s.end))) + .filter(i => i.isValid && i.overlaps(bounds)) + .sort((a, b) => a.start - b.start) + .reduce((acc, cur) => { + const last = acc.at(-1); + return last && last.end >= cur.start ? [...acc.slice(0, -1), last.union(cur)] : [...acc, cur]; + }, []); + + const slots = []; + let cursor = bounds.start.startOf('day'); + + while (cursor <= bounds.end) { + const [sH, sM] = workHours.start.split(':'); + const [eH, eM] = workHours.end.split(':'); + const workInt = Interval.fromDateTimes( + cursor.set({ hour: sH, minute: sM }), + cursor.set({ hour: eH, minute: eM }) + ).intersection(bounds); + + if (workInt?.isValid) { + let free = [workInt]; + busy.filter(b => b.overlaps(workInt)).forEach(b => free = free.flatMap(f => f.difference(b))); + + free.forEach(f => { + let s = f.start; + while (s.plus({ minutes: dur }) <= f.end) { + const e = s.plus({ minutes: dur }); + slots.push({ start: s.toISO(), end: e.toISO() }); + s = e; + } + }); + } + cursor = cursor.plus({ days: 1 }); + } + + return slots; +}; +export default findAvailableSlots; \ No newline at end of file diff --git a/tests/7_scheduler/outputs_gemini/gemini-3-pro-preview TEMP_0.5.js b/tests/7_scheduler/outputs_gemini/gemini-3-pro-preview TEMP_0.5.js new file mode 100644 index 0000000..47dae27 --- /dev/null +++ b/tests/7_scheduler/outputs_gemini/gemini-3-pro-preview TEMP_0.5.js @@ -0,0 +1,41 @@ +export const findAvailableSlots = async (c1, c2, { durationMinutes: d, searchRange: r, workHours: w }) => { + const { parseISO } = await import('https://cdn.jsdelivr.net/npm/date-fns@2.30.0/+esm'); + const toMs = x => parseISO(x).getTime(); + const [wsH, wsM] = w.start.split(':').map(Number); + const [weH, weM] = w.end.split(':').map(Number); + const rStart = toMs(r.start), rEnd = toMs(r.end), durMs = d * 6e4; + + const busy = [...c1, ...c2] + .map(x => ({ s: toMs(x.start), e: toMs(x.end) })) + .sort((a, b) => a.s - b.s) + .reduce((acc, cur) => { + if (acc.length && cur.s <= acc[acc.length - 1].e) acc[acc.length - 1].e = Math.max(acc[acc.length - 1].e, cur.e); + else acc.push(cur); + return acc; + }, []); + + let free = [], curr = new Date(rStart); + curr.setUTCHours(0, 0, 0, 0); + + while (curr.getTime() < rEnd) { + const s = Math.max(new Date(curr).setUTCHours(wsH, wsM, 0, 0), rStart); + const e = Math.min(new Date(curr).setUTCHours(weH, weM, 0, 0), rEnd); + if (s < e) free.push({ s, e }); + curr.setUTCDate(curr.getUTCDate() + 1); + } + + return busy.reduce((acc, b) => acc.flatMap(f => { + if (b.e <= f.s || b.s >= f.e) return [f]; + return [ + ...(f.s < b.s ? [{ s: f.s, e: b.s }] : []), + ...(f.e > b.e ? [{ s: b.e, e: f.e }] : []) + ]; + }), free).flatMap(f => { + const slots = []; + for (let t = f.s; t + durMs <= f.e; t += durMs) { + slots.push({ start: new Date(t).toISOString(), end: new Date(t + durMs).toISOString() }); + } + return slots; + }); +}; +export default findAvailableSlots; \ No newline at end of file diff --git a/tests/7_scheduler/outputs_gemini/gemini-3-pro-preview TEMP_0.6.js b/tests/7_scheduler/outputs_gemini/gemini-3-pro-preview TEMP_0.6.js new file mode 100644 index 0000000..20a4d66 --- /dev/null +++ b/tests/7_scheduler/outputs_gemini/gemini-3-pro-preview TEMP_0.6.js @@ -0,0 +1,45 @@ +export const findAvailableSlots = async (cal1, cal2, { durationMinutes: dur, searchRange: rng, workHours: wh }) => { + const { DateTime, Interval } = await import('https://cdn.skypack.dev/luxon'); + const zone = 'utc'; + const fromISO = t => DateTime.fromISO(t, { zone }); + const searchIv = Interval.fromDateTimes(fromISO(rng.start), fromISO(rng.end)); + + const busy = [...cal1, ...cal2] + .map(s => Interval.fromDateTimes(fromISO(s.start), fromISO(s.end))) + .filter(i => i.isValid && i.overlaps(searchIv)) + .sort((a, b) => a.start - b.start) + .reduce((acc, cur) => { + const last = acc[acc.length - 1]; + return last && (last.overlaps(cur) || last.abutsStart(cur)) + ? [...acc.slice(0, -1), last.union(cur)] + : [...acc, cur]; + }, []); + + const slots = []; + let curDate = searchIv.start.startOf('day'); + const [wsH, wsM] = wh.start.split(':'); + const [weH, weM] = wh.end.split(':'); + + while (curDate < searchIv.end) { + const workStart = curDate.set({ hour: wsH, minute: wsM }); + const workEnd = curDate.set({ hour: weH, minute: weM }); + const workIv = Interval.fromDateTimes(workStart, workEnd).intersection(searchIv); + + if (workIv && workIv.isValid) { + let free = [workIv]; + busy.forEach(b => { free = free.flatMap(f => f.difference(b)); }); + + free.forEach(iv => { + iv.splitBy({ minutes: dur }).forEach(chunk => { + if (Math.abs(chunk.length('minutes') - dur) < 0.01) { + slots.push({ start: chunk.start.toISO(), end: chunk.end.toISO() }); + } + }); + }); + } + curDate = curDate.plus({ days: 1 }); + } + + return slots; +}; +export default findAvailableSlots; \ No newline at end of file diff --git a/tests/7_scheduler/outputs_gemini/gemini-3-pro-preview TEMP_0.7.js b/tests/7_scheduler/outputs_gemini/gemini-3-pro-preview TEMP_0.7.js new file mode 100644 index 0000000..6705133 --- /dev/null +++ b/tests/7_scheduler/outputs_gemini/gemini-3-pro-preview TEMP_0.7.js @@ -0,0 +1,52 @@ +const findAvailableSlots = async (calA, calB, constraints) => { + const { DateTime: D } = await import('https://cdn.jsdelivr.net/npm/luxon@3.4.4/+esm'); + const { durationMinutes: dur, searchRange: rng, workHours: wh } = constraints; + + const utc = { zone: 'utc' }; + const parse = s => D.fromISO(s, utc); + const durMs = dur * 60000; + + const busy = [...calA, ...calB] + .map(x => ({ s: parse(x.start).valueOf(), e: parse(x.end).valueOf() })) + .sort((a, b) => a.s - b.s) + .reduce((acc, cur) => { + const last = acc.at(-1); + if (last && cur.s <= last.e) last.e = Math.max(last.e, cur.e); + else acc.push(cur); + return acc; + }, []); + + const slots = []; + const rangeStart = parse(rng.start).valueOf(); + const rangeEnd = parse(rng.end).valueOf(); + const [wsH, wsM] = wh.start.split(':').map(Number); + const [weH, weM] = wh.end.split(':').map(Number); + + let currDay = parse(rng.start).startOf('day'); + + while (currDay.valueOf() < rangeEnd) { + const wStart = Math.max(currDay.set({ hour: wsH, minute: wsM }).valueOf(), rangeStart); + const wEnd = Math.min(currDay.set({ hour: weH, minute: weM }).valueOf(), rangeEnd); + + if (wStart < wEnd) { + let ptr = wStart; + for (const b of busy) { + if (b.e <= ptr) continue; + if (b.s >= wEnd) break; + while (ptr + durMs <= b.s) { + slots.push({ start: D.fromMillis(ptr, utc).toISO(), end: D.fromMillis(ptr + durMs, utc).toISO() }); + ptr += durMs; + } + ptr = Math.max(ptr, b.e); + } + while (ptr + durMs <= wEnd) { + slots.push({ start: D.fromMillis(ptr, utc).toISO(), end: D.fromMillis(ptr + durMs, utc).toISO() }); + ptr += durMs; + } + } + currDay = currDay.plus({ days: 1 }); + } + + return slots; +}; +export default findAvailableSlots; \ No newline at end of file diff --git a/tests/7_scheduler/outputs_gemini/gemini-3-pro-preview TEMP_0.8.js b/tests/7_scheduler/outputs_gemini/gemini-3-pro-preview TEMP_0.8.js new file mode 100644 index 0000000..d115862 --- /dev/null +++ b/tests/7_scheduler/outputs_gemini/gemini-3-pro-preview TEMP_0.8.js @@ -0,0 +1,53 @@ +export const findAvailableSlots = async (cal1, cal2, { durationMinutes: dur, searchRange: rng, workHours: wh }) => { + const [djs, utc] = await Promise.all([ + import('https://esm.sh/dayjs@1.11.10'), + import('https://esm.sh/dayjs@1.11.10/plugin/utc') + ]); + const dayjs = djs.default; + dayjs.extend(utc.default); + + const parse = d => dayjs(d).utc(); + const [wsH, wsM] = wh.start.split(':').map(Number); + const [weH, weM] = wh.end.split(':').map(Number); + + let now = parse(rng.start); + const endLimit = parse(rng.end); + const slots = []; + + const busy = [...cal1, ...cal2] + .map(s => ({ s: parse(s.start), e: parse(s.end) })) + .sort((a, b) => a.s - b.s) + .reduce((acc, c) => { + const last = acc.at(-1); + if (last && c.s <= last.e) last.e = c.e > last.e ? c.e : last.e; + else acc.push(c); + return acc; + }, []); + + while (now.add(dur, 'm') <= endLimit) { + const wStart = now.hour(wsH).minute(wsM).second(0).millisecond(0); + const wEnd = now.hour(weH).minute(weM).second(0).millisecond(0); + + if (now < wStart) now = wStart; + + const next = now.add(dur, 'm'); + + if (next > wEnd) { + now = wStart.add(1, 'd'); + continue; + } + if (next > endLimit) break; + + const clash = busy.find(b => now < b.e && next > b.s); + + if (clash) { + now = clash.e; + } else { + slots.push({ start: now.toISOString(), end: next.toISOString() }); + now = next; + } + } + + return slots; +}; +export default findAvailableSlots; \ No newline at end of file diff --git a/tests/7_scheduler/outputs_gemini/gemini-3-pro-preview TEMP_0.9.js b/tests/7_scheduler/outputs_gemini/gemini-3-pro-preview TEMP_0.9.js new file mode 100644 index 0000000..9ac53a8 --- /dev/null +++ b/tests/7_scheduler/outputs_gemini/gemini-3-pro-preview TEMP_0.9.js @@ -0,0 +1,59 @@ +const findAvailableSlots = async (calA, calB, { durationMinutes, searchRange, workHours }) => { + const { parseISO, formatISO, addMinutes } = await import('https://cdn.jsdelivr.net/npm/date-fns@3.6.0/+esm'); + + const rangeStart = parseISO(searchRange.start).getTime(); + const rangeEnd = parseISO(searchRange.end).getTime(); + const durationMs = durationMinutes * 60 * 1000; + + const busy = [...calA, ...calB] + .map(s => ({ start: parseISO(s.start).getTime(), end: parseISO(s.end).getTime() })) + .sort((a, b) => a.start - b.start); + + const merged = []; + if (busy.length) { + let curr = busy[0]; + for (const next of busy.slice(1)) { + if (curr.end >= next.start) { + curr.end = Math.max(curr.end, next.end); + } else { + merged.push(curr); + curr = next; + } + } + merged.push(curr); + } + + const slots = []; + let now = rangeStart; + + while (now + durationMs <= rangeEnd) { + const currentDate = new Date(now); + const dateStr = currentDate.toISOString().split('T')[0]; + const workStart = parseISO(`${dateStr}T${workHours.start}:00Z`).getTime(); + const workEnd = parseISO(`${dateStr}T${workHours.end}:00Z`).getTime(); + + if (now < workStart) { + now = workStart; + continue; + } + + if (now + durationMs > workEnd) { + now = addMinutes(workStart, 24 * 60).getTime(); + continue; + } + + const conflict = merged.find(b => now < b.end && (now + durationMs) > b.start); + + if (conflict) { + now = conflict.end; + } else { + const start = new Date(now); + const end = new Date(now + durationMs); + slots.push({ start: formatISO(start), end: formatISO(end) }); + now += durationMs; + } + } + + return slots; +}; +export default findAvailableSlots; \ No newline at end of file diff --git a/tests/7_scheduler/outputs_gemini/gemini-3-pro-preview TEMP_0.js b/tests/7_scheduler/outputs_gemini/gemini-3-pro-preview TEMP_0.js new file mode 100644 index 0000000..1398f86 --- /dev/null +++ b/tests/7_scheduler/outputs_gemini/gemini-3-pro-preview TEMP_0.js @@ -0,0 +1,40 @@ +const findAvailableSlots = async (calA, calB, { durationMinutes: dur, searchRange: rng, workHours: wh }) => { + const { DateTime, Interval } = await import('https://cdn.jsdelivr.net/npm/luxon@3.4.4/+esm'); + const utc = t => DateTime.fromISO(t, { zone: 'utc' }); + + const busy = [...calA, ...calB] + .map(x => Interval.fromDateTimes(utc(x.start), utc(x.end))) + .sort((a, b) => a.start - b.start) + .reduce((acc, cur) => { + const last = acc[acc.length - 1]; + return last && last.end >= cur.start + ? (acc[acc.length - 1] = last.union(cur), acc) + : [...acc, cur]; + }, []); + + const rangeInt = Interval.fromDateTimes(utc(rng.start), utc(rng.end)); + const [wsH, wsM] = wh.start.split(':'); + const [weH, weM] = wh.end.split(':'); + + let curr = rangeInt.start.startOf('day'), workInts = []; + while (curr <= rangeInt.end) { + const wStart = curr.set({ hour: wsH, minute: wsM }); + const wEnd = curr.set({ hour: weH, minute: weM }); + const i = Interval.fromDateTimes(wStart, wEnd).intersection(rangeInt); + if (i?.isValid && !i.isEmpty()) workInts.push(i); + curr = curr.plus({ days: 1 }); + } + + return workInts + .flatMap(w => busy.reduce((acc, b) => acc.flatMap(a => a.difference(b)), [w])) + .flatMap(i => { + const slots = []; + let s = i.start; + while (s.plus({ minutes: dur }) <= i.end) { + slots.push({ start: s.toISO(), end: s.plus({ minutes: dur }).toISO() }); + s = s.plus({ minutes: dur }); + } + return slots; + }); +}; +export default findAvailableSlots; \ No newline at end of file diff --git a/tests/7_scheduler/outputs_gemini/gemini-3-pro-preview TEMP_1.1.js b/tests/7_scheduler/outputs_gemini/gemini-3-pro-preview TEMP_1.1.js new file mode 100644 index 0000000..c34ca29 --- /dev/null +++ b/tests/7_scheduler/outputs_gemini/gemini-3-pro-preview TEMP_1.1.js @@ -0,0 +1,49 @@ +const findAvailableSlots = async (calendarA, calendarB, constraints) => { + const { default: d } = await import('https://esm.sh/dayjs@1.11.10'); + const { default: u } = await import('https://esm.sh/dayjs@1.11.10/plugin/utc'); + d.extend(u); + + const D = d.utc; + const ms = constraints.durationMinutes * 60000; + const rangeS = D(constraints.searchRange.start); + const rangeE = D(constraints.searchRange.end); + const [wS_H, wS_M] = constraints.workHours.start.split(':').map(Number); + const [wE_H, wE_M] = constraints.workHours.end.split(':').map(Number); + + const busy = [...calendarA, ...calendarB] + .map(x => ({ s: D(x.start).valueOf(), e: D(x.end).valueOf() })) + .sort((a, b) => a.s - b.s) + .reduce((acc, c) => { + const l = acc[acc.length - 1]; + if (l && c.s < l.e) l.e = Math.max(l.e, c.e); + else acc.push(c); + return acc; + }, []); + + const slots = []; + let curr = rangeS.startOf('day'); + const endDay = rangeE.endOf('day'); + + while (curr.isBefore(endDay)) { + let sTime = curr.hour(wS_H).minute(wS_M).second(0).millisecond(0); + let eTime = curr.hour(wE_H).minute(wE_M).second(0).millisecond(0); + + const sVal = Math.max(sTime.valueOf(), rangeS.valueOf()); + const eVal = Math.min(eTime.valueOf(), rangeE.valueOf()); + + let ptr = sVal; + while (ptr + ms <= eVal) { + const conflict = busy.find(b => b.s < ptr + ms && b.e > ptr); + if (conflict) { + ptr = conflict.e; + } else { + slots.push({ start: D(ptr).format(), end: D(ptr + ms).format() }); + ptr += ms; + } + } + curr = curr.add(1, 'day'); + } + + return slots; +}; +export default findAvailableSlots; \ No newline at end of file diff --git a/tests/7_scheduler/outputs_gemini/gemini-3-pro-preview TEMP_1.js b/tests/7_scheduler/outputs_gemini/gemini-3-pro-preview TEMP_1.js new file mode 100644 index 0000000..4261060 --- /dev/null +++ b/tests/7_scheduler/outputs_gemini/gemini-3-pro-preview TEMP_1.js @@ -0,0 +1,49 @@ +const findAvailableSlots = async (calA, calB, { durationMinutes: dur, searchRange: rng, workHours: wh }) => { + const { addMinutes } = await import('https://cdn.jsdelivr.net/npm/date-fns@3.6.0/+esm'); + const parse = d => new Date(d).getTime(); + const toIso = t => new Date(t).toISOString(); + + const [rStart, rEnd] = [parse(rng.start), parse(rng.end)]; + const msDur = dur * 60000; + + const busy = [...calA, ...calB] + .map(x => ({ s: parse(x.start), e: parse(x.end) })) + .sort((a, b) => a.s - b.s) + .reduce((acc, c) => { + const last = acc[acc.length - 1]; + if (last && c.s < last.e) last.e = Math.max(last.e, c.e); + else acc.push({ ...c }); + return acc; + }, []); + + const slots = []; + let curr = new Date(rStart); + curr.setUTCHours(0, 0, 0, 0); + + while (curr.getTime() < rEnd) { + const [wsH, wsM] = wh.start.split(':'), [weH, weM] = wh.end.split(':'); + const wStart = new Date(curr).setUTCHours(+wsH, +wsM, 0, 0); + const wEnd = new Date(curr).setUTCHours(+weH, +weM, 0, 0); + + const winStart = Math.max(wStart, rStart); + const winEnd = Math.min(wEnd, rEnd); + + if (winStart < winEnd) { + let t = winStart; + while (t + msDur <= winEnd) { + const tEnd = addMinutes(t, dur).getTime(); + const clash = busy.find(b => t < b.e && tEnd > b.s); + + if (clash) t = clash.e; + else { + slots.push({ start: toIso(t), end: toIso(tEnd) }); + t = tEnd; + } + } + } + curr.setUTCDate(curr.getUTCDate() + 1); + } + + return slots; +}; +export default findAvailableSlots; \ No newline at end of file diff --git a/tests/8_json_validator/outputs_gemini/gemini-3-pro-preview TEMP_0.1.js b/tests/8_json_validator/outputs_gemini/gemini-3-pro-preview TEMP_0.1.js new file mode 100644 index 0000000..6c0d5c2 --- /dev/null +++ b/tests/8_json_validator/outputs_gemini/gemini-3-pro-preview TEMP_0.1.js @@ -0,0 +1,14 @@ +const validateJSON = async (data, schema) => { + try { + const { default: Ajv } = await import('https://esm.sh/ajv@8.17.1'); + const v = new Ajv({ allErrors: true }).compile(schema); + const valid = v(data); + return { + valid, + errors: valid ? [] : v.errors.map(e => `${e.instancePath} ${e.message}`.trim()) + }; + } catch (e) { + return { valid: false, errors: [e.message] }; + } +}; +export default validateJSON; \ No newline at end of file diff --git a/tests/8_json_validator/outputs_gemini/gemini-3-pro-preview TEMP_0.2.js b/tests/8_json_validator/outputs_gemini/gemini-3-pro-preview TEMP_0.2.js new file mode 100644 index 0000000..8726972 --- /dev/null +++ b/tests/8_json_validator/outputs_gemini/gemini-3-pro-preview TEMP_0.2.js @@ -0,0 +1,10 @@ +const validateJSON = async (d, s) => { + const { default: A } = await import('https://esm.sh/ajv@8.17.1'); + const v = new A({ allErrors: true }).compile(s); + const b = v(d); + return { + valid: b, + errors: b ? [] : v.errors.map(e => `${e.instancePath} ${e.message}`.trim()) + }; +}; +export default validateJSON; \ No newline at end of file diff --git a/tests/8_json_validator/outputs_gemini/gemini-3-pro-preview TEMP_0.3.js b/tests/8_json_validator/outputs_gemini/gemini-3-pro-preview TEMP_0.3.js new file mode 100644 index 0000000..d3f2edb --- /dev/null +++ b/tests/8_json_validator/outputs_gemini/gemini-3-pro-preview TEMP_0.3.js @@ -0,0 +1,7 @@ +const validateJSON = async (data, schema) => { + const { default: Ajv } = await import('https://esm.sh/ajv@8') + const validate = new Ajv({ allErrors: true }).compile(schema) + const valid = validate(data) + return { valid, errors: valid ? [] : validate.errors.map(e => `${e.instancePath} ${e.message}`.trim()) } +} +export default validateJSON; \ No newline at end of file diff --git a/tests/8_json_validator/outputs_gemini/gemini-3-pro-preview TEMP_0.4.js b/tests/8_json_validator/outputs_gemini/gemini-3-pro-preview TEMP_0.4.js new file mode 100644 index 0000000..bcaa335 --- /dev/null +++ b/tests/8_json_validator/outputs_gemini/gemini-3-pro-preview TEMP_0.4.js @@ -0,0 +1,11 @@ +const validateJSON = async (data, schema) => { + try { + const { default: Ajv } = await import('https://esm.sh/ajv@8.17.1') + const validate = new Ajv({ allErrors: true }).compile(schema) + const valid = validate(data) + return { valid, errors: valid ? [] : validate.errors.map(e => `${e.instancePath} ${e.message}`.trim()) } + } catch (err) { + return { valid: false, errors: [err.message] } + } +} +export default validateJSON; \ No newline at end of file diff --git a/tests/8_json_validator/outputs_gemini/gemini-3-pro-preview TEMP_0.5.js b/tests/8_json_validator/outputs_gemini/gemini-3-pro-preview TEMP_0.5.js new file mode 100644 index 0000000..e3c89d0 --- /dev/null +++ b/tests/8_json_validator/outputs_gemini/gemini-3-pro-preview TEMP_0.5.js @@ -0,0 +1,7 @@ +const validateJSON = async (data, schema) => { + const Ajv = (await import('https://esm.sh/ajv@8.17.1')).default + const validate = new Ajv({ allErrors: true }).compile(schema) + const valid = validate(data) + return { valid, errors: validate.errors?.map(e => e.message) ?? [] } +} +export default validateJSON; \ No newline at end of file diff --git a/tests/8_json_validator/outputs_gemini/gemini-3-pro-preview TEMP_0.6.js b/tests/8_json_validator/outputs_gemini/gemini-3-pro-preview TEMP_0.6.js new file mode 100644 index 0000000..9f2a0fb --- /dev/null +++ b/tests/8_json_validator/outputs_gemini/gemini-3-pro-preview TEMP_0.6.js @@ -0,0 +1,10 @@ +const validateJSON = async (d, s) => { + const { default: A } = await import('https://esm.sh/ajv@8.17.1'); + const v = new A({ allErrors: true }).compile(s); + const r = v(d); + return { + valid: r, + errors: r ? [] : v.errors.map(e => `${e.instancePath} ${e.message}`.trim()) + }; +}; +export default validateJSON; \ No newline at end of file diff --git a/tests/8_json_validator/outputs_gemini/gemini-3-pro-preview TEMP_0.7.js b/tests/8_json_validator/outputs_gemini/gemini-3-pro-preview TEMP_0.7.js new file mode 100644 index 0000000..29fd7aa --- /dev/null +++ b/tests/8_json_validator/outputs_gemini/gemini-3-pro-preview TEMP_0.7.js @@ -0,0 +1,7 @@ +const validateJSON = async (data, schema) => { + const { default: Ajv } = await import('https://esm.sh/ajv@8.17.1'); + const v = new Ajv({ allErrors: true }).compile(schema); + const valid = v(data); + return { valid, errors: valid ? [] : v.errors.map(e => `${e.instancePath} ${e.message}`.trim()) }; +}; +export default validateJSON; \ No newline at end of file diff --git a/tests/8_json_validator/outputs_gemini/gemini-3-pro-preview TEMP_0.8.js b/tests/8_json_validator/outputs_gemini/gemini-3-pro-preview TEMP_0.8.js new file mode 100644 index 0000000..c0facbc --- /dev/null +++ b/tests/8_json_validator/outputs_gemini/gemini-3-pro-preview TEMP_0.8.js @@ -0,0 +1,7 @@ +const validateJSON = async (data, schema) => { + const { default: Ajv } = await import('https://esm.sh/ajv@8.17.1') + const validate = new Ajv({ allErrors: true }).compile(schema) + const valid = validate(data) + return { valid, errors: valid ? [] : validate.errors.map(e => `${e.instancePath} ${e.message}`.trim()) } +} +export default validateJSON; \ No newline at end of file diff --git a/tests/8_json_validator/outputs_gemini/gemini-3-pro-preview TEMP_0.9.js b/tests/8_json_validator/outputs_gemini/gemini-3-pro-preview TEMP_0.9.js new file mode 100644 index 0000000..4c5075b --- /dev/null +++ b/tests/8_json_validator/outputs_gemini/gemini-3-pro-preview TEMP_0.9.js @@ -0,0 +1,14 @@ +const validateJSON = async (d, s) => { + try { + const Ajv = (await import('https://esm.sh/ajv@8.17.1')).default; + const v = new Ajv({ allErrors: true }).compile(s); + const b = v(d); + return { + valid: b, + errors: b ? [] : v.errors.map(e => `${e.instancePath} ${e.message}`.trim()) + }; + } catch (e) { + return { valid: false, errors: [e.message] }; + } +}; +export default validateJSON; \ No newline at end of file diff --git a/tests/8_json_validator/outputs_gemini/gemini-3-pro-preview TEMP_0.js b/tests/8_json_validator/outputs_gemini/gemini-3-pro-preview TEMP_0.js new file mode 100644 index 0000000..b0c77d4 --- /dev/null +++ b/tests/8_json_validator/outputs_gemini/gemini-3-pro-preview TEMP_0.js @@ -0,0 +1,10 @@ +const validateJSON = async (data, schema) => { + const { default: Ajv } = await import('https://esm.sh/ajv@8.12.0'); + const validate = new Ajv({ allErrors: true }).compile(schema); + const valid = validate(data); + return { + valid, + errors: valid ? [] : validate.errors.map(e => `${e.instancePath} ${e.message}`.trim()) + }; +}; +export default validateJSON; \ No newline at end of file diff --git a/tests/8_json_validator/outputs_gemini/gemini-3-pro-preview TEMP_1.1.js b/tests/8_json_validator/outputs_gemini/gemini-3-pro-preview TEMP_1.1.js new file mode 100644 index 0000000..2d98fe6 --- /dev/null +++ b/tests/8_json_validator/outputs_gemini/gemini-3-pro-preview TEMP_1.1.js @@ -0,0 +1,14 @@ +const validateJSON = async (data, schema) => { + try { + const { default: Ajv } = await import('https://esm.sh/ajv@8.17.1') + const validate = new Ajv({ allErrors: true }).compile(schema) + const valid = validate(data) + return { + valid, + errors: valid ? [] : validate.errors.map(e => `${e.instancePath} ${e.message}`.trim()) + } + } catch (e) { + return { valid: false, errors: [e.message] } + } +} +export default validateJSON; \ No newline at end of file diff --git a/tests/8_json_validator/outputs_gemini/gemini-3-pro-preview TEMP_1.js b/tests/8_json_validator/outputs_gemini/gemini-3-pro-preview TEMP_1.js new file mode 100644 index 0000000..fcc739d --- /dev/null +++ b/tests/8_json_validator/outputs_gemini/gemini-3-pro-preview TEMP_1.js @@ -0,0 +1,10 @@ +const validateJSON = async (data, schema) => { + const { default: Ajv } = await import('https://esm.sh/ajv@8.17.1') + const validator = new Ajv({ allErrors: true }).compile(schema) + const valid = validator(data) + return { + valid, + errors: valid ? [] : validator.errors.map(e => `${e.instancePath || 'root'} ${e.message}`) + } +} +export default validateJSON; \ No newline at end of file diff --git a/tests/9_stream_visualizer/outputs_gemini/gemini-3-pro-preview TEMP_0.1.js b/tests/9_stream_visualizer/outputs_gemini/gemini-3-pro-preview TEMP_0.1.js new file mode 100644 index 0000000..d4dd175 --- /dev/null +++ b/tests/9_stream_visualizer/outputs_gemini/gemini-3-pro-preview TEMP_0.1.js @@ -0,0 +1,28 @@ +export const createStreamVisualizer = async (src, { maxPoints: m, alpha: a, width: w, height: h, yDomain: yD }) => { + const data = []; + let ema; + + for await (const { timestamp: t, value: v } of src) { + ema = ema == null ? v : a * v + (1 - a) * ema; + data.push({ timestamp: t, value: v, ema }); + if (data.length > m) data.shift(); + } + + if (!data.length) return { data, path: '' }; + + const { scaleLinear, line } = await import('d3'); + + const x = scaleLinear() + .domain([data[0].timestamp, data[data.length - 1].timestamp]) + .range([0, w]); + + const y = scaleLinear() + .domain(yD) + .range([h, 0]); + + return { + data, + path: line().x(d => x(d.timestamp)).y(d => y(d.ema))(data) + }; +}; +export default createStreamVisualizer; \ No newline at end of file diff --git a/tests/9_stream_visualizer/outputs_gemini/gemini-3-pro-preview TEMP_0.2.js b/tests/9_stream_visualizer/outputs_gemini/gemini-3-pro-preview TEMP_0.2.js new file mode 100644 index 0000000..177de09 --- /dev/null +++ b/tests/9_stream_visualizer/outputs_gemini/gemini-3-pro-preview TEMP_0.2.js @@ -0,0 +1,14 @@ +export const createStreamVisualizer = async (iter, { maxPoints: M, alpha: A, width: W, height: H, yDomain: Y }) => { + const { scaleLinear, line } = await import('https://cdn.jsdelivr.net/npm/d3/+esm') + let D = [], E + for await (const { timestamp: t, value: v } of iter) { + E = E == null ? v : A * v + (1 - A) * E + D.push({ timestamp: t, value: v, ema: E }) + D.length > M && D.shift() + } + if (!D.length) return { data: [], path: "" } + const x = scaleLinear().domain([D[0].timestamp, D.at(-1).timestamp]).range([0, W]), + y = scaleLinear().domain(Y).range([H, 0]) + return { data: D, path: line().x(d => x(d.timestamp)).y(d => y(d.ema))(D) } +} +export default createStreamVisualizer; \ No newline at end of file diff --git a/tests/9_stream_visualizer/outputs_gemini/gemini-3-pro-preview TEMP_0.3.js b/tests/9_stream_visualizer/outputs_gemini/gemini-3-pro-preview TEMP_0.3.js new file mode 100644 index 0000000..41da658 --- /dev/null +++ b/tests/9_stream_visualizer/outputs_gemini/gemini-3-pro-preview TEMP_0.3.js @@ -0,0 +1,20 @@ +export const createStreamVisualizer = async (stream, { maxPoints: M, alpha: A, width: W, height: H, yDomain: Y }) => { + const { scaleLinear, line } = await import('https://esm.sh/d3@7'); + const data = []; + let ema; + + for await (const { timestamp: t, value: v } of stream) { + ema = ema === undefined ? v : A * v + (1 - A) * ema; + data.push({ timestamp: t, value: v, ema }); + if (data.length > M) data.shift(); + } + + if (!data.length) return { data, path: '' }; + + const x = scaleLinear().domain([data[0].timestamp, data.at(-1).timestamp]).range([0, W]); + const y = scaleLinear().domain(Y).range([H, 0]); + const gen = line().x(d => x(d.timestamp)).y(d => y(d.ema)); + + return { data, path: gen(data) }; +}; +export default createStreamVisualizer; \ No newline at end of file diff --git a/tests/9_stream_visualizer/outputs_gemini/gemini-3-pro-preview TEMP_0.4.js b/tests/9_stream_visualizer/outputs_gemini/gemini-3-pro-preview TEMP_0.4.js new file mode 100644 index 0000000..c432bc7 --- /dev/null +++ b/tests/9_stream_visualizer/outputs_gemini/gemini-3-pro-preview TEMP_0.4.js @@ -0,0 +1,20 @@ +export const createStreamVisualizer = async (src, { maxPoints: M, alpha: A, width: W, height: H, yDomain: YD }) => { + const { scaleLinear, line } = await import('https://esm.sh/d3@7'); + const D = []; + let E; + + for await (const { timestamp: t, value: v } of src) { + E = E == null ? v : A * v + (1 - A) * E; + D.push({ timestamp: t, value: v, ema: E }); + if (D.length > M) D.shift(); + } + + if (!D.length) return { data: [], path: '' }; + + const x = scaleLinear().domain([D[0].timestamp, D.at(-1).timestamp]).range([0, W]); + const y = scaleLinear().domain(YD).range([H, 0]); + const l = line().x(d => x(d.timestamp)).y(d => y(d.ema)); + + return { data: D, path: l(D) }; +}; +export default createStreamVisualizer; \ No newline at end of file diff --git a/tests/9_stream_visualizer/outputs_gemini/gemini-3-pro-preview TEMP_0.5.js b/tests/9_stream_visualizer/outputs_gemini/gemini-3-pro-preview TEMP_0.5.js new file mode 100644 index 0000000..630be77 --- /dev/null +++ b/tests/9_stream_visualizer/outputs_gemini/gemini-3-pro-preview TEMP_0.5.js @@ -0,0 +1,29 @@ +export const createStreamVisualizer = async (iter, { maxPoints, alpha, width, height, yDomain }) => { + const { scaleTime, scaleLinear, line } = await import('https://esm.sh/d3@7'); + const data = []; + let prev; + + for await (const { timestamp, value } of iter) { + const ema = prev == null ? value : alpha * value + (1 - alpha) * prev; + prev = ema; + data.push({ timestamp, value, ema }); + if (data.length > maxPoints) data.shift(); + } + + if (!data.length) return { data, path: "" }; + + const x = scaleTime() + .domain([data[0].timestamp, data.at(-1).timestamp]) + .range([0, width]); + + const y = scaleLinear() + .domain(yDomain) + .range([height, 0]); + + const d = line() + .x(p => x(p.timestamp)) + .y(p => y(p.ema))(data); + + return { data, path: d }; +}; +export default createStreamVisualizer; \ No newline at end of file diff --git a/tests/9_stream_visualizer/outputs_gemini/gemini-3-pro-preview TEMP_0.6.js b/tests/9_stream_visualizer/outputs_gemini/gemini-3-pro-preview TEMP_0.6.js new file mode 100644 index 0000000..099c2c6 --- /dev/null +++ b/tests/9_stream_visualizer/outputs_gemini/gemini-3-pro-preview TEMP_0.6.js @@ -0,0 +1,19 @@ +export const createStreamVisualizer = async (stream, { maxPoints, alpha, width, height, yDomain }) => { + const { scaleLinear, line } = await import('https://esm.sh/d3'); + const data = []; + + for await (const { timestamp: t, value: v } of stream) { + const prev = data.at(-1); + data.push({ timestamp: t, value: v, ema: prev ? alpha * v + (1 - alpha) * prev.ema : v }); + 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 gen = line().x(d => x(d.timestamp)).y(d => y(d.ema)); + + return { data, path: gen(data) }; +}; +export default createStreamVisualizer; \ No newline at end of file diff --git a/tests/9_stream_visualizer/outputs_gemini/gemini-3-pro-preview TEMP_0.7.js b/tests/9_stream_visualizer/outputs_gemini/gemini-3-pro-preview TEMP_0.7.js new file mode 100644 index 0000000..e46ddca --- /dev/null +++ b/tests/9_stream_visualizer/outputs_gemini/gemini-3-pro-preview TEMP_0.7.js @@ -0,0 +1,29 @@ +const createStreamVisualizer = async (feed, { maxPoints, alpha, width, height, yDomain }) => { + const { scaleLinear, line } = await import('https://esm.sh/d3'); + const data = []; + let prev; + + for await (const { timestamp, value } of feed) { + const ema = prev == null ? value : alpha * value + (1 - alpha) * prev; + prev = ema; + 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 generator = line() + .x(d => x(d.timestamp)) + .y(d => y(d.ema)); + + return { data, path: generator(data) || '' }; +}; +export default createStreamVisualizer; \ No newline at end of file diff --git a/tests/9_stream_visualizer/outputs_gemini/gemini-3-pro-preview TEMP_0.8.js b/tests/9_stream_visualizer/outputs_gemini/gemini-3-pro-preview TEMP_0.8.js new file mode 100644 index 0000000..29cfa09 --- /dev/null +++ b/tests/9_stream_visualizer/outputs_gemini/gemini-3-pro-preview TEMP_0.8.js @@ -0,0 +1,28 @@ +export const createStreamVisualizer = async (iter, { maxPoints, alpha, width, height, yDomain }) => { + const { scaleLinear, line } = await import('https://esm.sh/d3'); + const data = []; + let ema; + + for await (const { timestamp, value } of iter) { + ema = ema == null ? value : alpha * value + (1 - alpha) * ema; + 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; \ No newline at end of file diff --git a/tests/9_stream_visualizer/outputs_gemini/gemini-3-pro-preview TEMP_0.9.js b/tests/9_stream_visualizer/outputs_gemini/gemini-3-pro-preview TEMP_0.9.js new file mode 100644 index 0000000..d88e53a --- /dev/null +++ b/tests/9_stream_visualizer/outputs_gemini/gemini-3-pro-preview TEMP_0.9.js @@ -0,0 +1,28 @@ +export const createStreamVisualizer = async (stream, { maxPoints, alpha, width, height, yDomain }) => { + const d3 = await import('https://cdn.jsdelivr.net/npm/d3@7/+esm'); + const data = []; + let ema; + + for await (const { timestamp, value } of stream) { + ema = ema === undefined ? value : alpha * value + (1 - alpha) * ema; + 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.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; \ No newline at end of file diff --git a/tests/9_stream_visualizer/outputs_gemini/gemini-3-pro-preview TEMP_0.js b/tests/9_stream_visualizer/outputs_gemini/gemini-3-pro-preview TEMP_0.js new file mode 100644 index 0000000..5dff418 --- /dev/null +++ b/tests/9_stream_visualizer/outputs_gemini/gemini-3-pro-preview TEMP_0.js @@ -0,0 +1,28 @@ +export const createStreamVisualizer = async (iter, { maxPoints: max, alpha: a, width: w, height: h, yDomain: yd }) => { + const { scaleLinear, line } = await import('https://esm.sh/d3'); + const data = []; + let ema; + + for await (const { timestamp: t, value: v } of iter) { + ema = ema == null ? v : a * v + (1 - a) * ema; + data.push({ timestamp: t, value: v, ema }); + if (data.length > max) data.shift(); + } + + if (!data.length) return { data, path: '' }; + + const x = scaleLinear() + .domain([data[0].timestamp, data[data.length - 1].timestamp]) + .range([0, w]); + + const y = scaleLinear() + .domain(yd) + .range([h, 0]); + + const gen = line() + .x(d => x(d.timestamp)) + .y(d => y(d.ema)); + + return { data, path: gen(data) }; +}; +export default createStreamVisualizer; \ No newline at end of file diff --git a/tests/9_stream_visualizer/outputs_gemini/gemini-3-pro-preview TEMP_1.1.js b/tests/9_stream_visualizer/outputs_gemini/gemini-3-pro-preview TEMP_1.1.js new file mode 100644 index 0000000..ae27e9c --- /dev/null +++ b/tests/9_stream_visualizer/outputs_gemini/gemini-3-pro-preview TEMP_1.1.js @@ -0,0 +1,28 @@ +const createStreamVisualizer = async (stream, { maxPoints, alpha, width, height, yDomain }) => { + const { scaleLinear, line } = await import('https://esm.sh/d3@7'); + 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 pathGen = line() + .x(d => x(d.timestamp)) + .y(d => y(d.ema)); + + return { data, path: pathGen(data) }; +}; +export default createStreamVisualizer; \ No newline at end of file diff --git a/tests/9_stream_visualizer/outputs_gemini/gemini-3-pro-preview TEMP_1.js b/tests/9_stream_visualizer/outputs_gemini/gemini-3-pro-preview TEMP_1.js new file mode 100644 index 0000000..72a7205 --- /dev/null +++ b/tests/9_stream_visualizer/outputs_gemini/gemini-3-pro-preview TEMP_1.js @@ -0,0 +1,28 @@ +export const createStreamVisualizer = async (stream, { maxPoints: M, alpha: A, width: W, height: H, yDomain: Y }) => { + const { scaleLinear, line } = await import('https://esm.sh/d3'); + const data = []; + let ema; + + for await (const { timestamp: t, value: v } of stream) { + ema = ema == null ? v : A * v + (1 - A) * ema; + data.push({ timestamp: t, value: v, ema }); + if (data.length > M) data.shift(); + } + + if (!data.length) return { data, path: null }; + + const x = scaleLinear() + .domain([data[0].timestamp, data.at(-1).timestamp]) + .range([0, W]); + + const y = scaleLinear() + .domain(Y) + .range([H, 0]); + + const gen = line() + .x(d => x(d.timestamp)) + .y(d => y(d.ema)); + + return { data, path: gen(data) }; +}; +export default createStreamVisualizer; \ No newline at end of file