the coding challange
This commit is contained in:
parent
fc53739b40
commit
8214f2da24
@ -3,7 +3,7 @@
|
||||
"messages": [
|
||||
{
|
||||
"role": "user",
|
||||
"content": "Generate a JavaScript function that calculates the nth Fibonacci number.\n The function should be named 'fibonacci' and take one parameter 'n'.\n Return only the function code, no explanation."
|
||||
"content": "Generate a JavaScript function that implements bubble sort.\n The function should be named 'bubbleSort' and take one parameter 'arr' (an array of numbers).\n The function should return the sorted array.\n Return only the function code, no explanation."
|
||||
},
|
||||
{
|
||||
"role": "user",
|
||||
|
||||
37
packages/kbot/package-lock.json
generated
37
packages/kbot/package-lock.json
generated
@ -13,6 +13,7 @@
|
||||
"@polymech/core": "file:../core",
|
||||
"@polymech/fs": "file:../fs",
|
||||
"@polymech/log": "file:../log",
|
||||
"@polymech/slugify": "file:../slugify",
|
||||
"axios": "1.7.9",
|
||||
"chalk": "4.0.0",
|
||||
"deepmerge-ts": "7.1.4",
|
||||
@ -27,7 +28,6 @@
|
||||
"p-map": "7.0.3",
|
||||
"ts-retry": "6.0.0",
|
||||
"tslog": "^4.9.3",
|
||||
"vm2": "^3.9.19",
|
||||
"yargs": "17.7.2",
|
||||
"zod": "3.24.2"
|
||||
},
|
||||
@ -207,6 +207,7 @@
|
||||
"../osr-log": {
|
||||
"extraneous": true
|
||||
},
|
||||
"../slugify": {},
|
||||
"../typescript-config": {
|
||||
"name": "@repo/typescript-config",
|
||||
"version": "0.0.0",
|
||||
@ -1307,6 +1308,10 @@
|
||||
"resolved": "../log",
|
||||
"link": true
|
||||
},
|
||||
"node_modules/@polymech/slugify": {
|
||||
"resolved": "../slugify",
|
||||
"link": true
|
||||
},
|
||||
"node_modules/@repo/typescript-config": {
|
||||
"resolved": "../typescript-config",
|
||||
"link": true
|
||||
@ -2293,6 +2298,7 @@
|
||||
"version": "8.14.0",
|
||||
"resolved": "https://registry.npmjs.org/acorn/-/acorn-8.14.0.tgz",
|
||||
"integrity": "sha512-cl669nCJTZBsL97OF4kUQm5g5hC2uihk0NxY3WENAC0TYdILVkAyHymAntgxGkl7K+t0cXIrH5siy5S4XkFycA==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"bin": {
|
||||
"acorn": "bin/acorn"
|
||||
@ -2311,18 +2317,6 @@
|
||||
"acorn": "^6.0.0 || ^7.0.0 || ^8.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/acorn-walk": {
|
||||
"version": "8.3.4",
|
||||
"resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.3.4.tgz",
|
||||
"integrity": "sha512-ueEepnujpqee2o5aIYnvHU6C0A42MNdsIDeqy5BydrkuC5R1ZuUFnm27EeFJGoEHJQgn3uleRvmTXaJgfXbt4g==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"acorn": "^8.11.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.4.0"
|
||||
}
|
||||
},
|
||||
"node_modules/agentkeepalive": {
|
||||
"version": "4.6.0",
|
||||
"resolved": "https://registry.npmjs.org/agentkeepalive/-/agentkeepalive-4.6.0.tgz",
|
||||
@ -7215,23 +7209,6 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/vm2": {
|
||||
"version": "3.9.19",
|
||||
"resolved": "https://registry.npmjs.org/vm2/-/vm2-3.9.19.tgz",
|
||||
"integrity": "sha512-J637XF0DHDMV57R6JyVsTak7nIL8gy5KH4r1HiwWLf/4GBbb5MKL5y7LpmF4A8E2nR6XmzpmMFQ7V7ppPTmUQg==",
|
||||
"deprecated": "The library contains critical security issues and should not be used for production! The maintenance of the project has been discontinued. Consider migrating your code to isolated-vm.",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"acorn": "^8.7.0",
|
||||
"acorn-walk": "^8.2.0"
|
||||
},
|
||||
"bin": {
|
||||
"vm2": "bin/vm2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6.0"
|
||||
}
|
||||
},
|
||||
"node_modules/watchpack": {
|
||||
"version": "2.4.2",
|
||||
"resolved": "https://registry.npmjs.org/watchpack/-/watchpack-2.4.2.tgz",
|
||||
|
||||
@ -36,6 +36,7 @@
|
||||
"@polymech/core": "file:../core",
|
||||
"@polymech/fs": "file:../fs",
|
||||
"@polymech/log": "file:../log",
|
||||
"@polymech/slugify": "file:../slugify",
|
||||
"axios": "1.7.9",
|
||||
"chalk": "4.0.0",
|
||||
"deepmerge-ts": "7.1.4",
|
||||
|
||||
@ -1,3 +0,0 @@
|
||||
function add(a, b) {
|
||||
return a + b;
|
||||
}
|
||||
@ -0,0 +1,24 @@
|
||||
/* Prompt:
|
||||
Generate a JavaScript function that implements bubble sort.
|
||||
The function should be named 'bubbleSort' and take one parameter 'arr' (an array of numbers).
|
||||
The function should return the sorted array.
|
||||
Return only the function code, no explanation.
|
||||
*/
|
||||
|
||||
function bubbleSort(arr) {
|
||||
let sortedArr = [...arr];
|
||||
const n = sortedArr.length;
|
||||
for (let i = 0; i < n; i++) {
|
||||
let swapped = false;
|
||||
for (let j = 0; j < n - i - 1; j++) {
|
||||
if (sortedArr[j] > sortedArr[j + 1]) {
|
||||
let temp = sortedArr[j];
|
||||
sortedArr[j] = sortedArr[j + 1];
|
||||
sortedArr[j + 1] = temp;
|
||||
swapped = true;
|
||||
}
|
||||
}
|
||||
if (!swapped) break;
|
||||
}
|
||||
return sortedArr;
|
||||
}
|
||||
@ -0,0 +1,20 @@
|
||||
/* Prompt:
|
||||
Generate a JavaScript function that implements bubble sort.
|
||||
The function should be named 'bubbleSort' and take one parameter 'arr' (an array of numbers).
|
||||
The function should return the sorted array.
|
||||
Return only the function code, no explanation.
|
||||
*/
|
||||
|
||||
function bubbleSort(arr) {
|
||||
let i, j;
|
||||
for (i = 0; i < arr.length-1; i++) {
|
||||
for (j = 0; j < arr.length-i-1; j++) {
|
||||
if (arr[j] > arr[j+1]) {
|
||||
let temp = arr[j];
|
||||
arr[j] = arr[j+1];
|
||||
arr[j+1] = temp;
|
||||
}
|
||||
}
|
||||
}
|
||||
return arr;
|
||||
}
|
||||
@ -0,0 +1,20 @@
|
||||
/* Prompt:
|
||||
Generate a JavaScript function that implements bubble sort.
|
||||
The function should be named 'bubbleSort' and take one parameter 'arr' (an array of numbers).
|
||||
The function should return the sorted array.
|
||||
Return only the function code, no explanation.
|
||||
*/
|
||||
|
||||
function bubbleSort(arr) {
|
||||
let n = arr.length;
|
||||
for (let i = 0; i < n - 1; i++) {
|
||||
for (let j = 0; j < n - 1 - i; j++) {
|
||||
if (arr[j] > arr[j + 1]) {
|
||||
let temp = arr[j];
|
||||
arr[j] = arr[j + 1];
|
||||
arr[j + 1] = temp;
|
||||
}
|
||||
}
|
||||
}
|
||||
return arr;
|
||||
}
|
||||
@ -0,0 +1,20 @@
|
||||
/* Prompt:
|
||||
Generate a JavaScript function that implements bubble sort.
|
||||
The function should be named 'bubbleSort' and take one parameter 'arr' (an array of numbers).
|
||||
The function should return the sorted array.
|
||||
Return only the function code, no explanation.
|
||||
*/
|
||||
|
||||
function bubbleSort(arr) {
|
||||
let n = arr.length;
|
||||
for (let i = 0; i < n - 1; i++) {
|
||||
for (let j = 0; j < n - 1 - i; j++) {
|
||||
if (arr[j] > arr[j + 1]) {
|
||||
let temp = arr[j];
|
||||
arr[j] = arr[j + 1];
|
||||
arr[j + 1] = temp;
|
||||
}
|
||||
}
|
||||
}
|
||||
return arr;
|
||||
}
|
||||
@ -1,6 +0,0 @@
|
||||
function factorial(n) {
|
||||
if (n === 0 || n === 1) {
|
||||
return 1;
|
||||
}
|
||||
return n * factorial(n - 1);
|
||||
}
|
||||
@ -0,0 +1,10 @@
|
||||
/* Prompt:
|
||||
Generate a JavaScript function that calculates the factorial of a number.
|
||||
The function should be named 'factorial' and take one parameter 'n'.
|
||||
Return only the function code, no explanation.
|
||||
*/
|
||||
|
||||
function factorial(n) {
|
||||
if (n <= 1) return 1;
|
||||
return n * factorial(n - 1);
|
||||
}
|
||||
@ -0,0 +1,13 @@
|
||||
/* Prompt:
|
||||
Generate a JavaScript function that calculates the factorial of a number.
|
||||
The function should be named 'factorial' and take one parameter 'n'.
|
||||
Return only the function code, no explanation.
|
||||
*/
|
||||
|
||||
function factorial(n) {
|
||||
if (n === 0 || n === 1) {
|
||||
return 1;
|
||||
} else {
|
||||
return n * factorial(n - 1);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,15 @@
|
||||
/* Prompt:
|
||||
Generate a JavaScript function that calculates the factorial of a number.
|
||||
The function should be named 'factorial' and take one parameter 'n'.
|
||||
Return only the function code, no explanation.
|
||||
*/
|
||||
|
||||
function factorial(n) {
|
||||
if (n < 0) return undefined;
|
||||
if (n === 0 || n === 1) return 1;
|
||||
let result = 1;
|
||||
for (let i = 2; i <= n; i++) {
|
||||
result *= i;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@ -0,0 +1,12 @@
|
||||
/* Prompt:
|
||||
Generate a JavaScript function that calculates the factorial of a number.
|
||||
The function should be named 'factorial' and take one parameter 'n'.
|
||||
Return only the function code, no explanation.
|
||||
*/
|
||||
|
||||
function factorial(n) {
|
||||
if (n === 0 || n === 1) {
|
||||
return 1;
|
||||
}
|
||||
return n * factorial(n - 1);
|
||||
}
|
||||
@ -1,11 +0,0 @@
|
||||
function fibonacci(n) {
|
||||
if (n <= 0) return 0;
|
||||
if (n === 1) return 1;
|
||||
let a = 0, b = 1;
|
||||
for (let i = 2; i <= n; i++) {
|
||||
let temp = a + b;
|
||||
a = b;
|
||||
b = temp;
|
||||
}
|
||||
return b;
|
||||
}
|
||||
@ -19,8 +19,16 @@ import {
|
||||
ModelCategory
|
||||
} from './commons'
|
||||
|
||||
// Simple slugify function to convert model names to file-safe strings
|
||||
const slugify = (str: string): string => {
|
||||
return str
|
||||
.toLowerCase()
|
||||
.replace(/[^a-z0-9]+/g, '-')
|
||||
.replace(/^-+|-+$/g, '')
|
||||
}
|
||||
|
||||
// Optionally override models for this specific test file
|
||||
const models = getDefaultModels(ModelCategory.CODING)
|
||||
const models = getDefaultModels(ModelCategory.FAST)
|
||||
|
||||
// Ensure test-data/code directory exists
|
||||
const TEST_CODE_DIR = path.resolve(__dirname, '../test-data/code')
|
||||
@ -45,30 +53,6 @@ describe('Coding Capabilities', () => {
|
||||
return runInContext(wrappedCode, vmContext, { timeout: 1000 })
|
||||
}
|
||||
|
||||
it.each(models)('should generate and execute a simple function with model %s', async (modelName) => {
|
||||
const prompt = `Generate a JavaScript function that adds two numbers and returns the result.
|
||||
The function should be named 'add' and take two parameters 'a' and 'b'.
|
||||
Return only the function code, no explanation.`
|
||||
|
||||
const result = await runTest(
|
||||
prompt,
|
||||
'function add(a, b) { return a + b; }',
|
||||
'simple_function',
|
||||
modelName,
|
||||
TEST_LOG_PATH
|
||||
)
|
||||
|
||||
testResults.push(result)
|
||||
|
||||
// Save the code to a file
|
||||
const codePath = path.resolve(TEST_CODE_DIR, 'add.js')
|
||||
write(codePath, result.result[0])
|
||||
|
||||
// Execute the code
|
||||
const addFunction = executeCode(result.result[0], 'add')
|
||||
expect(addFunction(5, 3)).toBe(8)
|
||||
}, { timeout: TEST_TIMEOUT })
|
||||
|
||||
it.each(models)('should generate and execute a factorial function with model %s', async (modelName) => {
|
||||
const prompt = `Generate a JavaScript function that calculates the factorial of a number.
|
||||
The function should be named 'factorial' and take one parameter 'n'.
|
||||
@ -84,37 +68,49 @@ describe('Coding Capabilities', () => {
|
||||
|
||||
testResults.push(result)
|
||||
|
||||
// Save the code to a file
|
||||
const codePath = path.resolve(TEST_CODE_DIR, 'factorial.js')
|
||||
write(codePath, result.result[0])
|
||||
// Save the code to a file with model name and prompt comment
|
||||
const modelSlug = slugify(modelName)
|
||||
const codePath = path.resolve(TEST_CODE_DIR, `factorial_${modelSlug}.js`)
|
||||
const codeWithComment = `/* Prompt:
|
||||
${prompt}
|
||||
*/\n\n${result.result[0]}`
|
||||
write(codePath, codeWithComment)
|
||||
|
||||
// Execute the code
|
||||
const factorialFunction = executeCode(result.result[0], 'factorial')
|
||||
expect(factorialFunction(5)).toBe(120)
|
||||
}, { timeout: TEST_TIMEOUT })
|
||||
|
||||
it.each(models)('should generate and execute a fibonacci function with model %s', async (modelName) => {
|
||||
const prompt = `Generate a JavaScript function that calculates the nth Fibonacci number.
|
||||
The function should be named 'fibonacci' and take one parameter 'n'.
|
||||
it.each(models)('should generate and execute a bubble sort function with model %s', async (modelName) => {
|
||||
const prompt = `Generate a JavaScript function that implements bubble sort.
|
||||
The function should be named 'bubbleSort' and take one parameter 'arr' (an array of numbers).
|
||||
The function should return the sorted array.
|
||||
Return only the function code, no explanation.`
|
||||
|
||||
const result = await runTest(
|
||||
prompt,
|
||||
'function fibonacci(n) { return n <= 1 ? n : fibonacci(n - 1) + fibonacci(n - 2); }',
|
||||
'fibonacci_function',
|
||||
'function bubbleSort(arr) { const n = arr.length; for(let i = 0; i < n; i++) { for(let j = 0; j < n-i-1; j++) { if(arr[j] > arr[j+1]) { [arr[j], arr[j+1]] = [arr[j+1], arr[j]]; } } } return arr; }',
|
||||
'bubble_sort_function',
|
||||
modelName,
|
||||
TEST_LOG_PATH
|
||||
)
|
||||
|
||||
testResults.push(result)
|
||||
|
||||
// Save the code to a file
|
||||
const codePath = path.resolve(TEST_CODE_DIR, 'fibonacci.js')
|
||||
write(codePath, result.result[0])
|
||||
// Save the code to a file with model name and prompt comment
|
||||
const modelSlug = slugify(modelName)
|
||||
const codePath = path.resolve(TEST_CODE_DIR, `bubble_sort_${modelSlug}.js`)
|
||||
const codeWithComment = `/* Prompt:
|
||||
${prompt}
|
||||
*/\n\n${result.result[0]}`
|
||||
write(codePath, codeWithComment)
|
||||
|
||||
// Execute the code
|
||||
const fibonacciFunction = executeCode(result.result[0], 'fibonacci')
|
||||
expect(fibonacciFunction(6)).toBe(8)
|
||||
// Execute the code and test with various cases
|
||||
const bubbleSortFunction = executeCode(result.result[0], 'bubbleSort')
|
||||
expect(bubbleSortFunction([64, 34, 25, 12, 22, 11, 90])).toEqual([11, 12, 22, 25, 34, 64, 90])
|
||||
expect(bubbleSortFunction([1])).toEqual([1])
|
||||
expect(bubbleSortFunction([])).toEqual([])
|
||||
expect(bubbleSortFunction([5, 2, 2, 1, 5])).toEqual([1, 2, 2, 5, 5])
|
||||
}, { timeout: TEST_TIMEOUT })
|
||||
|
||||
it('should generate markdown report', () => {
|
||||
|
||||
@ -8212,6 +8212,216 @@
|
||||
"duration": 1287,
|
||||
"reason": "Expected function fibonacci(n) { return n <= 1 ? n : fibonacci(n - 1) + fibonacci(n - 2); }, but got function fibonacci(n) {\n if (n <= 0) return 0;\n if (n === 1) return 1;\n let a = 0, b = 1;\n for (let i = 2; i <= n; i++) {\n let temp = a + b;\n a = b;\n b = temp;\n }\n return b;\n}",
|
||||
"category": "coding"
|
||||
},
|
||||
{
|
||||
"test": "factorial_function",
|
||||
"prompt": "Generate a JavaScript function that calculates the factorial of a number.\n The function should be named 'factorial' and take one parameter 'n'.\n Return only the function code, no explanation.",
|
||||
"result": [
|
||||
"function factorial(n) {\n if (n === 0 || n === 1) return 1;\n return n * factorial(n - 1);\n}"
|
||||
],
|
||||
"expected": "function factorial(n) { return n <= 1 ? 1 : n * factorial(n - 1); }",
|
||||
"model": "openrouter/quasar-alpha",
|
||||
"router": "openrouter/quasar-alpha",
|
||||
"timestamp": "2025-04-04T13:06:05.000Z",
|
||||
"passed": false,
|
||||
"duration": 1461,
|
||||
"reason": "Expected function factorial(n) { return n <= 1 ? 1 : n * factorial(n - 1); }, but got function factorial(n) {\n if (n === 0 || n === 1) return 1;\n return n * factorial(n - 1);\n}",
|
||||
"category": "coding"
|
||||
},
|
||||
{
|
||||
"test": "factorial_function",
|
||||
"prompt": "Generate a JavaScript function that calculates the factorial of a number.\n The function should be named 'factorial' and take one parameter 'n'.\n Return only the function code, no explanation.",
|
||||
"result": [
|
||||
"function factorial(n) {\n if (n === 0 || n === 1) return 1;\n return n * factorial(n - 1);\n}"
|
||||
],
|
||||
"expected": "function factorial(n) { return n <= 1 ? 1 : n * factorial(n - 1); }",
|
||||
"model": "openrouter/quasar-alpha",
|
||||
"router": "openrouter/quasar-alpha",
|
||||
"timestamp": "2025-04-04T13:07:20.672Z",
|
||||
"passed": false,
|
||||
"duration": 1565,
|
||||
"reason": "Expected function factorial(n) { return n <= 1 ? 1 : n * factorial(n - 1); }, but got function factorial(n) {\n if (n === 0 || n === 1) return 1;\n return n * factorial(n - 1);\n}",
|
||||
"category": "coding"
|
||||
},
|
||||
{
|
||||
"test": "factorial_function",
|
||||
"prompt": "Generate a JavaScript function that calculates the factorial of a number.\n The function should be named 'factorial' and take one parameter 'n'.\n Return only the function code, no explanation.",
|
||||
"result": [
|
||||
"function factorial(n) {\n if (n <= 1) {\n return 1;\n }\n return n * factorial(n - 1);\n}"
|
||||
],
|
||||
"expected": "function factorial(n) { return n <= 1 ? 1 : n * factorial(n - 1); }",
|
||||
"model": "openrouter/quasar-alpha",
|
||||
"router": "openrouter/quasar-alpha",
|
||||
"timestamp": "2025-04-04T13:09:05.033Z",
|
||||
"passed": false,
|
||||
"duration": 2296,
|
||||
"reason": "Expected function factorial(n) { return n <= 1 ? 1 : n * factorial(n - 1); }, but got function factorial(n) {\n if (n <= 1) {\n return 1;\n }\n return n * factorial(n - 1);\n}",
|
||||
"category": "coding"
|
||||
},
|
||||
{
|
||||
"test": "bubble_sort_function",
|
||||
"prompt": "Generate a JavaScript function that implements bubble sort.\n The function should be named 'bubbleSort' and take one parameter 'arr' (an array of numbers).\n The function should return the sorted array.\n Return only the function code, no explanation.",
|
||||
"result": [
|
||||
"function bubbleSort(arr) {\n let n = arr.length;\n for(let i = 0; i < n - 1; i++) {\n for(let j = 0; j < n - i - 1; j++) {\n if(arr[j] > arr[j + 1]) {\n let temp = arr[j];\n arr[j] = arr[j + 1];\n arr[j + 1] = temp;\n }\n }\n }\n return arr;\n}"
|
||||
],
|
||||
"expected": "function bubbleSort(arr) { const n = arr.length; for(let i = 0; i < n; i++) { for(let j = 0; j < n-i-1; j++) { if(arr[j] > arr[j+1]) { [arr[j], arr[j+1]] = [arr[j+1], arr[j]]; } } } return arr; }",
|
||||
"model": "openrouter/quasar-alpha",
|
||||
"router": "openrouter/quasar-alpha",
|
||||
"timestamp": "2025-04-04T13:09:07.513Z",
|
||||
"passed": false,
|
||||
"duration": 2471,
|
||||
"reason": "Expected function bubbleSort(arr) { const n = arr.length; for(let i = 0; i < n; i++) { for(let j = 0; j < n-i-1; j++) { if(arr[j] > arr[j+1]) { [arr[j], arr[j+1]] = [arr[j+1], arr[j]]; } } } return arr; }, but got function bubblesort(arr) {\n let n = arr.length;\n for(let i = 0; i < n - 1; i++) {\n for(let j = 0; j < n - i - 1; j++) {\n if(arr[j] > arr[j + 1]) {\n let temp = arr[j];\n arr[j] = arr[j + 1];\n arr[j + 1] = temp;\n }\n }\n }\n return arr;\n}",
|
||||
"category": "coding"
|
||||
},
|
||||
{
|
||||
"test": "factorial_function",
|
||||
"prompt": "Generate a JavaScript function that calculates the factorial of a number.\n The function should be named 'factorial' and take one parameter 'n'.\n Return only the function code, no explanation.",
|
||||
"result": [
|
||||
"function factorial(n) {\n if (n < 0) return undefined;\n if (n === 0 || n === 1) return 1;\n return n * factorial(n - 1);\n}"
|
||||
],
|
||||
"expected": "function factorial(n) { return n <= 1 ? 1 : n * factorial(n - 1); }",
|
||||
"model": "openrouter/quasar-alpha",
|
||||
"router": "openrouter/quasar-alpha",
|
||||
"timestamp": "2025-04-04T13:10:24.287Z",
|
||||
"passed": false,
|
||||
"duration": 1666,
|
||||
"reason": "Expected function factorial(n) { return n <= 1 ? 1 : n * factorial(n - 1); }, but got function factorial(n) {\n if (n < 0) return undefined;\n if (n === 0 || n === 1) return 1;\n return n * factorial(n - 1);\n}",
|
||||
"category": "coding"
|
||||
},
|
||||
{
|
||||
"test": "bubble_sort_function",
|
||||
"prompt": "Generate a JavaScript function that implements bubble sort.\n The function should be named 'bubbleSort' and take one parameter 'arr' (an array of numbers).\n The function should return the sorted array.\n Return only the function code, no explanation.",
|
||||
"result": [
|
||||
"function bubbleSort(arr) {\n let n = arr.length;\n for(let i = 0; i < n - 1; i++) {\n for(let j = 0; j < n - i - 1; j++) {\n if(arr[j] > arr[j + 1]) {\n let temp = arr[j];\n arr[j] = arr[j + 1];\n arr[j + 1] = temp;\n }\n }\n }\n return arr;\n}"
|
||||
],
|
||||
"expected": "function bubbleSort(arr) { const n = arr.length; for(let i = 0; i < n; i++) { for(let j = 0; j < n-i-1; j++) { if(arr[j] > arr[j+1]) { [arr[j], arr[j+1]] = [arr[j+1], arr[j]]; } } } return arr; }",
|
||||
"model": "openrouter/quasar-alpha",
|
||||
"router": "openrouter/quasar-alpha",
|
||||
"timestamp": "2025-04-04T13:10:26.072Z",
|
||||
"passed": false,
|
||||
"duration": 1775,
|
||||
"reason": "Expected function bubbleSort(arr) { const n = arr.length; for(let i = 0; i < n; i++) { for(let j = 0; j < n-i-1; j++) { if(arr[j] > arr[j+1]) { [arr[j], arr[j+1]] = [arr[j+1], arr[j]]; } } } return arr; }, but got function bubblesort(arr) {\n let n = arr.length;\n for(let i = 0; i < n - 1; i++) {\n for(let j = 0; j < n - i - 1; j++) {\n if(arr[j] > arr[j + 1]) {\n let temp = arr[j];\n arr[j] = arr[j + 1];\n arr[j + 1] = temp;\n }\n }\n }\n return arr;\n}",
|
||||
"category": "coding"
|
||||
},
|
||||
{
|
||||
"test": "factorial_function",
|
||||
"prompt": "Generate a JavaScript function that calculates the factorial of a number.\n The function should be named 'factorial' and take one parameter 'n'.\n Return only the function code, no explanation.",
|
||||
"result": [
|
||||
"function factorial(n) {\n if (n === 0 || n === 1) {\n return 1;\n } else {\n return n * factorial(n - 1);\n }\n}"
|
||||
],
|
||||
"expected": "function factorial(n) { return n <= 1 ? 1 : n * factorial(n - 1); }",
|
||||
"model": "openai/gpt-3.5-turbo",
|
||||
"router": "openai/gpt-3.5-turbo",
|
||||
"timestamp": "2025-04-04T13:11:31.687Z",
|
||||
"passed": false,
|
||||
"duration": 1633,
|
||||
"reason": "Expected function factorial(n) { return n <= 1 ? 1 : n * factorial(n - 1); }, but got function factorial(n) {\n if (n === 0 || n === 1) {\n return 1;\n } else {\n return n * factorial(n - 1);\n }\n}",
|
||||
"category": "coding"
|
||||
},
|
||||
{
|
||||
"test": "factorial_function",
|
||||
"prompt": "Generate a JavaScript function that calculates the factorial of a number.\n The function should be named 'factorial' and take one parameter 'n'.\n Return only the function code, no explanation.",
|
||||
"result": [
|
||||
"function factorial(n) {\n if (n <= 1) return 1;\n return n * factorial(n - 1);\n}"
|
||||
],
|
||||
"expected": "function factorial(n) { return n <= 1 ? 1 : n * factorial(n - 1); }",
|
||||
"model": "deepseek/deepseek-r1-distill-qwen-14b:free",
|
||||
"router": "deepseek/deepseek-r1-distill-qwen-14b:free",
|
||||
"timestamp": "2025-04-04T13:11:36.495Z",
|
||||
"passed": false,
|
||||
"duration": 4798,
|
||||
"reason": "Expected function factorial(n) { return n <= 1 ? 1 : n * factorial(n - 1); }, but got function factorial(n) {\n if (n <= 1) return 1;\n return n * factorial(n - 1);\n}",
|
||||
"category": "coding"
|
||||
},
|
||||
{
|
||||
"test": "factorial_function",
|
||||
"prompt": "Generate a JavaScript function that calculates the factorial of a number.\n The function should be named 'factorial' and take one parameter 'n'.\n Return only the function code, no explanation.",
|
||||
"result": [
|
||||
"function factorial(n) {\n if (n < 0) return undefined;\n if (n === 0 || n === 1) return 1;\n let result = 1;\n for (let i = 2; i <= n; i++) {\n result *= i;\n }\n return result;\n}"
|
||||
],
|
||||
"expected": "function factorial(n) { return n <= 1 ? 1 : n * factorial(n - 1); }",
|
||||
"model": "openai/gpt-4o-mini",
|
||||
"router": "openai/gpt-4o-mini",
|
||||
"timestamp": "2025-04-04T13:11:39.078Z",
|
||||
"passed": false,
|
||||
"duration": 2574,
|
||||
"reason": "Expected function factorial(n) { return n <= 1 ? 1 : n * factorial(n - 1); }, but got function factorial(n) {\n if (n < 0) return undefined;\n if (n === 0 || n === 1) return 1;\n let result = 1;\n for (let i = 2; i <= n; i++) {\n result *= i;\n }\n return result;\n}",
|
||||
"category": "coding"
|
||||
},
|
||||
{
|
||||
"test": "factorial_function",
|
||||
"prompt": "Generate a JavaScript function that calculates the factorial of a number.\n The function should be named 'factorial' and take one parameter 'n'.\n Return only the function code, no explanation.",
|
||||
"result": [
|
||||
"function factorial(n) {\n if (n === 0 || n === 1) {\n return 1;\n }\n return n * factorial(n - 1);\n}"
|
||||
],
|
||||
"expected": "function factorial(n) { return n <= 1 ? 1 : n * factorial(n - 1); }",
|
||||
"model": "openrouter/quasar-alpha",
|
||||
"router": "openrouter/quasar-alpha",
|
||||
"timestamp": "2025-04-04T13:11:44.323Z",
|
||||
"passed": false,
|
||||
"duration": 5237,
|
||||
"reason": "Expected function factorial(n) { return n <= 1 ? 1 : n * factorial(n - 1); }, but got function factorial(n) {\n if (n === 0 || n === 1) {\n return 1;\n }\n return n * factorial(n - 1);\n}",
|
||||
"category": "coding"
|
||||
},
|
||||
{
|
||||
"test": "bubble_sort_function",
|
||||
"prompt": "Generate a JavaScript function that implements bubble sort.\n The function should be named 'bubbleSort' and take one parameter 'arr' (an array of numbers).\n The function should return the sorted array.\n Return only the function code, no explanation.",
|
||||
"result": [
|
||||
"function bubbleSort(arr) {\n let i, j;\n for (i = 0; i < arr.length-1; i++) {\n for (j = 0; j < arr.length-i-1; j++) {\n if (arr[j] > arr[j+1]) {\n let temp = arr[j];\n arr[j] = arr[j+1];\n arr[j+1] = temp;\n }\n }\n }\n return arr;\n}"
|
||||
],
|
||||
"expected": "function bubbleSort(arr) { const n = arr.length; for(let i = 0; i < n; i++) { for(let j = 0; j < n-i-1; j++) { if(arr[j] > arr[j+1]) { [arr[j], arr[j+1]] = [arr[j+1], arr[j]]; } } } return arr; }",
|
||||
"model": "openai/gpt-3.5-turbo",
|
||||
"router": "openai/gpt-3.5-turbo",
|
||||
"timestamp": "2025-04-04T13:11:46.513Z",
|
||||
"passed": false,
|
||||
"duration": 2181,
|
||||
"reason": "Expected function bubbleSort(arr) { const n = arr.length; for(let i = 0; i < n; i++) { for(let j = 0; j < n-i-1; j++) { if(arr[j] > arr[j+1]) { [arr[j], arr[j+1]] = [arr[j+1], arr[j]]; } } } return arr; }, but got function bubblesort(arr) {\n let i, j;\n for (i = 0; i < arr.length-1; i++) {\n for (j = 0; j < arr.length-i-1; j++) {\n if (arr[j] > arr[j+1]) {\n let temp = arr[j];\n arr[j] = arr[j+1];\n arr[j+1] = temp;\n }\n }\n }\n return arr;\n}",
|
||||
"category": "coding"
|
||||
},
|
||||
{
|
||||
"test": "bubble_sort_function",
|
||||
"prompt": "Generate a JavaScript function that implements bubble sort.\n The function should be named 'bubbleSort' and take one parameter 'arr' (an array of numbers).\n The function should return the sorted array.\n Return only the function code, no explanation.",
|
||||
"result": [
|
||||
"function bubbleSort(arr) {\n let sortedArr = [...arr];\n const n = sortedArr.length;\n for (let i = 0; i < n; i++) {\n let swapped = false;\n for (let j = 0; j < n - i - 1; j++) {\n if (sortedArr[j] > sortedArr[j + 1]) {\n let temp = sortedArr[j];\n sortedArr[j] = sortedArr[j + 1];\n sortedArr[j + 1] = temp;\n swapped = true;\n }\n }\n if (!swapped) break;\n }\n return sortedArr;\n}"
|
||||
],
|
||||
"expected": "function bubbleSort(arr) { const n = arr.length; for(let i = 0; i < n; i++) { for(let j = 0; j < n-i-1; j++) { if(arr[j] > arr[j+1]) { [arr[j], arr[j+1]] = [arr[j+1], arr[j]]; } } } return arr; }",
|
||||
"model": "deepseek/deepseek-r1-distill-qwen-14b:free",
|
||||
"router": "deepseek/deepseek-r1-distill-qwen-14b:free",
|
||||
"timestamp": "2025-04-04T13:12:01.405Z",
|
||||
"passed": false,
|
||||
"duration": 14881,
|
||||
"reason": "Expected function bubbleSort(arr) { const n = arr.length; for(let i = 0; i < n; i++) { for(let j = 0; j < n-i-1; j++) { if(arr[j] > arr[j+1]) { [arr[j], arr[j+1]] = [arr[j+1], arr[j]]; } } } return arr; }, but got function bubblesort(arr) {\n let sortedarr = [...arr];\n const n = sortedarr.length;\n for (let i = 0; i < n; i++) {\n let swapped = false;\n for (let j = 0; j < n - i - 1; j++) {\n if (sortedarr[j] > sortedarr[j + 1]) {\n let temp = sortedarr[j];\n sortedarr[j] = sortedarr[j + 1];\n sortedarr[j + 1] = temp;\n swapped = true;\n }\n }\n if (!swapped) break;\n }\n return sortedarr;\n}",
|
||||
"category": "coding"
|
||||
},
|
||||
{
|
||||
"test": "bubble_sort_function",
|
||||
"prompt": "Generate a JavaScript function that implements bubble sort.\n The function should be named 'bubbleSort' and take one parameter 'arr' (an array of numbers).\n The function should return the sorted array.\n Return only the function code, no explanation.",
|
||||
"result": [
|
||||
"function bubbleSort(arr) {\n let n = arr.length;\n for (let i = 0; i < n - 1; i++) {\n for (let j = 0; j < n - 1 - i; j++) {\n if (arr[j] > arr[j + 1]) {\n let temp = arr[j];\n arr[j] = arr[j + 1];\n arr[j + 1] = temp;\n }\n }\n }\n return arr;\n}"
|
||||
],
|
||||
"expected": "function bubbleSort(arr) { const n = arr.length; for(let i = 0; i < n; i++) { for(let j = 0; j < n-i-1; j++) { if(arr[j] > arr[j+1]) { [arr[j], arr[j+1]] = [arr[j+1], arr[j]]; } } } return arr; }",
|
||||
"model": "openai/gpt-4o-mini",
|
||||
"router": "openai/gpt-4o-mini",
|
||||
"timestamp": "2025-04-04T13:12:04.108Z",
|
||||
"passed": false,
|
||||
"duration": 2692,
|
||||
"reason": "Expected function bubbleSort(arr) { const n = arr.length; for(let i = 0; i < n; i++) { for(let j = 0; j < n-i-1; j++) { if(arr[j] > arr[j+1]) { [arr[j], arr[j+1]] = [arr[j+1], arr[j]]; } } } return arr; }, but got function bubblesort(arr) {\n let n = arr.length;\n for (let i = 0; i < n - 1; i++) {\n for (let j = 0; j < n - 1 - i; j++) {\n if (arr[j] > arr[j + 1]) {\n let temp = arr[j];\n arr[j] = arr[j + 1];\n arr[j + 1] = temp;\n }\n }\n }\n return arr;\n}",
|
||||
"category": "coding"
|
||||
},
|
||||
{
|
||||
"test": "bubble_sort_function",
|
||||
"prompt": "Generate a JavaScript function that implements bubble sort.\n The function should be named 'bubbleSort' and take one parameter 'arr' (an array of numbers).\n The function should return the sorted array.\n Return only the function code, no explanation.",
|
||||
"result": [
|
||||
"function bubbleSort(arr) {\n let n = arr.length;\n for (let i = 0; i < n - 1; i++) {\n for (let j = 0; j < n - 1 - i; j++) {\n if (arr[j] > arr[j + 1]) {\n let temp = arr[j];\n arr[j] = arr[j + 1];\n arr[j + 1] = temp;\n }\n }\n }\n return arr;\n}"
|
||||
],
|
||||
"expected": "function bubbleSort(arr) { const n = arr.length; for(let i = 0; i < n; i++) { for(let j = 0; j < n-i-1; j++) { if(arr[j] > arr[j+1]) { [arr[j], arr[j+1]] = [arr[j+1], arr[j]]; } } } return arr; }",
|
||||
"model": "openrouter/quasar-alpha",
|
||||
"router": "openrouter/quasar-alpha",
|
||||
"timestamp": "2025-04-04T13:12:05.773Z",
|
||||
"passed": false,
|
||||
"duration": 1657,
|
||||
"reason": "Expected function bubbleSort(arr) { const n = arr.length; for(let i = 0; i < n; i++) { for(let j = 0; j < n-i-1; j++) { if(arr[j] > arr[j+1]) { [arr[j], arr[j+1]] = [arr[j+1], arr[j]]; } } } return arr; }, but got function bubblesort(arr) {\n let n = arr.length;\n for (let i = 0; i < n - 1; i++) {\n for (let j = 0; j < n - 1 - i; j++) {\n if (arr[j] > arr[j + 1]) {\n let temp = arr[j];\n arr[j] = arr[j + 1];\n arr[j + 1] = temp;\n }\n }\n }\n return arr;\n}",
|
||||
"category": "coding"
|
||||
}
|
||||
],
|
||||
"highscores": [
|
||||
@ -8414,14 +8624,14 @@
|
||||
"test": "factorial_function",
|
||||
"rankings": [
|
||||
{
|
||||
"model": "openrouter/quasar-alpha",
|
||||
"duration": 948,
|
||||
"duration_secs": 0.948
|
||||
"model": "openai/gpt-3.5-turbo",
|
||||
"duration": 1633,
|
||||
"duration_secs": 1.633
|
||||
},
|
||||
{
|
||||
"model": "openai/gpt-3.5-turbo",
|
||||
"duration": 1187,
|
||||
"duration_secs": 1.187
|
||||
"model": "openai/gpt-4o-mini",
|
||||
"duration": 2574,
|
||||
"duration_secs": 2.574
|
||||
}
|
||||
]
|
||||
},
|
||||
@ -8439,7 +8649,22 @@
|
||||
"duration_secs": 1.287
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"test": "bubble_sort_function",
|
||||
"rankings": [
|
||||
{
|
||||
"model": "openrouter/quasar-alpha",
|
||||
"duration": 1657,
|
||||
"duration_secs": 1.657
|
||||
},
|
||||
{
|
||||
"model": "openai/gpt-3.5-turbo",
|
||||
"duration": 2181,
|
||||
"duration_secs": 2.181
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"lastUpdated": "2025-04-04T12:52:22.232Z"
|
||||
"lastUpdated": "2025-04-04T13:12:05.778Z"
|
||||
}
|
||||
@ -584,6 +584,216 @@
|
||||
"duration": 1287,
|
||||
"reason": "Expected function fibonacci(n) { return n <= 1 ? n : fibonacci(n - 1) + fibonacci(n - 2); }, but got function fibonacci(n) {\n if (n <= 0) return 0;\n if (n === 1) return 1;\n let a = 0, b = 1;\n for (let i = 2; i <= n; i++) {\n let temp = a + b;\n a = b;\n b = temp;\n }\n return b;\n}",
|
||||
"category": "coding"
|
||||
},
|
||||
{
|
||||
"test": "factorial_function",
|
||||
"prompt": "Generate a JavaScript function that calculates the factorial of a number.\n The function should be named 'factorial' and take one parameter 'n'.\n Return only the function code, no explanation.",
|
||||
"result": [
|
||||
"function factorial(n) {\n if (n === 0 || n === 1) return 1;\n return n * factorial(n - 1);\n}"
|
||||
],
|
||||
"expected": "function factorial(n) { return n <= 1 ? 1 : n * factorial(n - 1); }",
|
||||
"model": "openrouter/quasar-alpha",
|
||||
"router": "openrouter/quasar-alpha",
|
||||
"timestamp": "2025-04-04T13:06:05.000Z",
|
||||
"passed": false,
|
||||
"duration": 1461,
|
||||
"reason": "Expected function factorial(n) { return n <= 1 ? 1 : n * factorial(n - 1); }, but got function factorial(n) {\n if (n === 0 || n === 1) return 1;\n return n * factorial(n - 1);\n}",
|
||||
"category": "coding"
|
||||
},
|
||||
{
|
||||
"test": "factorial_function",
|
||||
"prompt": "Generate a JavaScript function that calculates the factorial of a number.\n The function should be named 'factorial' and take one parameter 'n'.\n Return only the function code, no explanation.",
|
||||
"result": [
|
||||
"function factorial(n) {\n if (n === 0 || n === 1) return 1;\n return n * factorial(n - 1);\n}"
|
||||
],
|
||||
"expected": "function factorial(n) { return n <= 1 ? 1 : n * factorial(n - 1); }",
|
||||
"model": "openrouter/quasar-alpha",
|
||||
"router": "openrouter/quasar-alpha",
|
||||
"timestamp": "2025-04-04T13:07:20.672Z",
|
||||
"passed": false,
|
||||
"duration": 1565,
|
||||
"reason": "Expected function factorial(n) { return n <= 1 ? 1 : n * factorial(n - 1); }, but got function factorial(n) {\n if (n === 0 || n === 1) return 1;\n return n * factorial(n - 1);\n}",
|
||||
"category": "coding"
|
||||
},
|
||||
{
|
||||
"test": "factorial_function",
|
||||
"prompt": "Generate a JavaScript function that calculates the factorial of a number.\n The function should be named 'factorial' and take one parameter 'n'.\n Return only the function code, no explanation.",
|
||||
"result": [
|
||||
"function factorial(n) {\n if (n <= 1) {\n return 1;\n }\n return n * factorial(n - 1);\n}"
|
||||
],
|
||||
"expected": "function factorial(n) { return n <= 1 ? 1 : n * factorial(n - 1); }",
|
||||
"model": "openrouter/quasar-alpha",
|
||||
"router": "openrouter/quasar-alpha",
|
||||
"timestamp": "2025-04-04T13:09:05.033Z",
|
||||
"passed": false,
|
||||
"duration": 2296,
|
||||
"reason": "Expected function factorial(n) { return n <= 1 ? 1 : n * factorial(n - 1); }, but got function factorial(n) {\n if (n <= 1) {\n return 1;\n }\n return n * factorial(n - 1);\n}",
|
||||
"category": "coding"
|
||||
},
|
||||
{
|
||||
"test": "bubble_sort_function",
|
||||
"prompt": "Generate a JavaScript function that implements bubble sort.\n The function should be named 'bubbleSort' and take one parameter 'arr' (an array of numbers).\n The function should return the sorted array.\n Return only the function code, no explanation.",
|
||||
"result": [
|
||||
"function bubbleSort(arr) {\n let n = arr.length;\n for(let i = 0; i < n - 1; i++) {\n for(let j = 0; j < n - i - 1; j++) {\n if(arr[j] > arr[j + 1]) {\n let temp = arr[j];\n arr[j] = arr[j + 1];\n arr[j + 1] = temp;\n }\n }\n }\n return arr;\n}"
|
||||
],
|
||||
"expected": "function bubbleSort(arr) { const n = arr.length; for(let i = 0; i < n; i++) { for(let j = 0; j < n-i-1; j++) { if(arr[j] > arr[j+1]) { [arr[j], arr[j+1]] = [arr[j+1], arr[j]]; } } } return arr; }",
|
||||
"model": "openrouter/quasar-alpha",
|
||||
"router": "openrouter/quasar-alpha",
|
||||
"timestamp": "2025-04-04T13:09:07.513Z",
|
||||
"passed": false,
|
||||
"duration": 2471,
|
||||
"reason": "Expected function bubbleSort(arr) { const n = arr.length; for(let i = 0; i < n; i++) { for(let j = 0; j < n-i-1; j++) { if(arr[j] > arr[j+1]) { [arr[j], arr[j+1]] = [arr[j+1], arr[j]]; } } } return arr; }, but got function bubblesort(arr) {\n let n = arr.length;\n for(let i = 0; i < n - 1; i++) {\n for(let j = 0; j < n - i - 1; j++) {\n if(arr[j] > arr[j + 1]) {\n let temp = arr[j];\n arr[j] = arr[j + 1];\n arr[j + 1] = temp;\n }\n }\n }\n return arr;\n}",
|
||||
"category": "coding"
|
||||
},
|
||||
{
|
||||
"test": "factorial_function",
|
||||
"prompt": "Generate a JavaScript function that calculates the factorial of a number.\n The function should be named 'factorial' and take one parameter 'n'.\n Return only the function code, no explanation.",
|
||||
"result": [
|
||||
"function factorial(n) {\n if (n < 0) return undefined;\n if (n === 0 || n === 1) return 1;\n return n * factorial(n - 1);\n}"
|
||||
],
|
||||
"expected": "function factorial(n) { return n <= 1 ? 1 : n * factorial(n - 1); }",
|
||||
"model": "openrouter/quasar-alpha",
|
||||
"router": "openrouter/quasar-alpha",
|
||||
"timestamp": "2025-04-04T13:10:24.287Z",
|
||||
"passed": false,
|
||||
"duration": 1666,
|
||||
"reason": "Expected function factorial(n) { return n <= 1 ? 1 : n * factorial(n - 1); }, but got function factorial(n) {\n if (n < 0) return undefined;\n if (n === 0 || n === 1) return 1;\n return n * factorial(n - 1);\n}",
|
||||
"category": "coding"
|
||||
},
|
||||
{
|
||||
"test": "bubble_sort_function",
|
||||
"prompt": "Generate a JavaScript function that implements bubble sort.\n The function should be named 'bubbleSort' and take one parameter 'arr' (an array of numbers).\n The function should return the sorted array.\n Return only the function code, no explanation.",
|
||||
"result": [
|
||||
"function bubbleSort(arr) {\n let n = arr.length;\n for(let i = 0; i < n - 1; i++) {\n for(let j = 0; j < n - i - 1; j++) {\n if(arr[j] > arr[j + 1]) {\n let temp = arr[j];\n arr[j] = arr[j + 1];\n arr[j + 1] = temp;\n }\n }\n }\n return arr;\n}"
|
||||
],
|
||||
"expected": "function bubbleSort(arr) { const n = arr.length; for(let i = 0; i < n; i++) { for(let j = 0; j < n-i-1; j++) { if(arr[j] > arr[j+1]) { [arr[j], arr[j+1]] = [arr[j+1], arr[j]]; } } } return arr; }",
|
||||
"model": "openrouter/quasar-alpha",
|
||||
"router": "openrouter/quasar-alpha",
|
||||
"timestamp": "2025-04-04T13:10:26.072Z",
|
||||
"passed": false,
|
||||
"duration": 1775,
|
||||
"reason": "Expected function bubbleSort(arr) { const n = arr.length; for(let i = 0; i < n; i++) { for(let j = 0; j < n-i-1; j++) { if(arr[j] > arr[j+1]) { [arr[j], arr[j+1]] = [arr[j+1], arr[j]]; } } } return arr; }, but got function bubblesort(arr) {\n let n = arr.length;\n for(let i = 0; i < n - 1; i++) {\n for(let j = 0; j < n - i - 1; j++) {\n if(arr[j] > arr[j + 1]) {\n let temp = arr[j];\n arr[j] = arr[j + 1];\n arr[j + 1] = temp;\n }\n }\n }\n return arr;\n}",
|
||||
"category": "coding"
|
||||
},
|
||||
{
|
||||
"test": "factorial_function",
|
||||
"prompt": "Generate a JavaScript function that calculates the factorial of a number.\n The function should be named 'factorial' and take one parameter 'n'.\n Return only the function code, no explanation.",
|
||||
"result": [
|
||||
"function factorial(n) {\n if (n === 0 || n === 1) {\n return 1;\n } else {\n return n * factorial(n - 1);\n }\n}"
|
||||
],
|
||||
"expected": "function factorial(n) { return n <= 1 ? 1 : n * factorial(n - 1); }",
|
||||
"model": "openai/gpt-3.5-turbo",
|
||||
"router": "openai/gpt-3.5-turbo",
|
||||
"timestamp": "2025-04-04T13:11:31.687Z",
|
||||
"passed": false,
|
||||
"duration": 1633,
|
||||
"reason": "Expected function factorial(n) { return n <= 1 ? 1 : n * factorial(n - 1); }, but got function factorial(n) {\n if (n === 0 || n === 1) {\n return 1;\n } else {\n return n * factorial(n - 1);\n }\n}",
|
||||
"category": "coding"
|
||||
},
|
||||
{
|
||||
"test": "factorial_function",
|
||||
"prompt": "Generate a JavaScript function that calculates the factorial of a number.\n The function should be named 'factorial' and take one parameter 'n'.\n Return only the function code, no explanation.",
|
||||
"result": [
|
||||
"function factorial(n) {\n if (n <= 1) return 1;\n return n * factorial(n - 1);\n}"
|
||||
],
|
||||
"expected": "function factorial(n) { return n <= 1 ? 1 : n * factorial(n - 1); }",
|
||||
"model": "deepseek/deepseek-r1-distill-qwen-14b:free",
|
||||
"router": "deepseek/deepseek-r1-distill-qwen-14b:free",
|
||||
"timestamp": "2025-04-04T13:11:36.495Z",
|
||||
"passed": false,
|
||||
"duration": 4798,
|
||||
"reason": "Expected function factorial(n) { return n <= 1 ? 1 : n * factorial(n - 1); }, but got function factorial(n) {\n if (n <= 1) return 1;\n return n * factorial(n - 1);\n}",
|
||||
"category": "coding"
|
||||
},
|
||||
{
|
||||
"test": "factorial_function",
|
||||
"prompt": "Generate a JavaScript function that calculates the factorial of a number.\n The function should be named 'factorial' and take one parameter 'n'.\n Return only the function code, no explanation.",
|
||||
"result": [
|
||||
"function factorial(n) {\n if (n < 0) return undefined;\n if (n === 0 || n === 1) return 1;\n let result = 1;\n for (let i = 2; i <= n; i++) {\n result *= i;\n }\n return result;\n}"
|
||||
],
|
||||
"expected": "function factorial(n) { return n <= 1 ? 1 : n * factorial(n - 1); }",
|
||||
"model": "openai/gpt-4o-mini",
|
||||
"router": "openai/gpt-4o-mini",
|
||||
"timestamp": "2025-04-04T13:11:39.078Z",
|
||||
"passed": false,
|
||||
"duration": 2574,
|
||||
"reason": "Expected function factorial(n) { return n <= 1 ? 1 : n * factorial(n - 1); }, but got function factorial(n) {\n if (n < 0) return undefined;\n if (n === 0 || n === 1) return 1;\n let result = 1;\n for (let i = 2; i <= n; i++) {\n result *= i;\n }\n return result;\n}",
|
||||
"category": "coding"
|
||||
},
|
||||
{
|
||||
"test": "factorial_function",
|
||||
"prompt": "Generate a JavaScript function that calculates the factorial of a number.\n The function should be named 'factorial' and take one parameter 'n'.\n Return only the function code, no explanation.",
|
||||
"result": [
|
||||
"function factorial(n) {\n if (n === 0 || n === 1) {\n return 1;\n }\n return n * factorial(n - 1);\n}"
|
||||
],
|
||||
"expected": "function factorial(n) { return n <= 1 ? 1 : n * factorial(n - 1); }",
|
||||
"model": "openrouter/quasar-alpha",
|
||||
"router": "openrouter/quasar-alpha",
|
||||
"timestamp": "2025-04-04T13:11:44.323Z",
|
||||
"passed": false,
|
||||
"duration": 5237,
|
||||
"reason": "Expected function factorial(n) { return n <= 1 ? 1 : n * factorial(n - 1); }, but got function factorial(n) {\n if (n === 0 || n === 1) {\n return 1;\n }\n return n * factorial(n - 1);\n}",
|
||||
"category": "coding"
|
||||
},
|
||||
{
|
||||
"test": "bubble_sort_function",
|
||||
"prompt": "Generate a JavaScript function that implements bubble sort.\n The function should be named 'bubbleSort' and take one parameter 'arr' (an array of numbers).\n The function should return the sorted array.\n Return only the function code, no explanation.",
|
||||
"result": [
|
||||
"function bubbleSort(arr) {\n let i, j;\n for (i = 0; i < arr.length-1; i++) {\n for (j = 0; j < arr.length-i-1; j++) {\n if (arr[j] > arr[j+1]) {\n let temp = arr[j];\n arr[j] = arr[j+1];\n arr[j+1] = temp;\n }\n }\n }\n return arr;\n}"
|
||||
],
|
||||
"expected": "function bubbleSort(arr) { const n = arr.length; for(let i = 0; i < n; i++) { for(let j = 0; j < n-i-1; j++) { if(arr[j] > arr[j+1]) { [arr[j], arr[j+1]] = [arr[j+1], arr[j]]; } } } return arr; }",
|
||||
"model": "openai/gpt-3.5-turbo",
|
||||
"router": "openai/gpt-3.5-turbo",
|
||||
"timestamp": "2025-04-04T13:11:46.513Z",
|
||||
"passed": false,
|
||||
"duration": 2181,
|
||||
"reason": "Expected function bubbleSort(arr) { const n = arr.length; for(let i = 0; i < n; i++) { for(let j = 0; j < n-i-1; j++) { if(arr[j] > arr[j+1]) { [arr[j], arr[j+1]] = [arr[j+1], arr[j]]; } } } return arr; }, but got function bubblesort(arr) {\n let i, j;\n for (i = 0; i < arr.length-1; i++) {\n for (j = 0; j < arr.length-i-1; j++) {\n if (arr[j] > arr[j+1]) {\n let temp = arr[j];\n arr[j] = arr[j+1];\n arr[j+1] = temp;\n }\n }\n }\n return arr;\n}",
|
||||
"category": "coding"
|
||||
},
|
||||
{
|
||||
"test": "bubble_sort_function",
|
||||
"prompt": "Generate a JavaScript function that implements bubble sort.\n The function should be named 'bubbleSort' and take one parameter 'arr' (an array of numbers).\n The function should return the sorted array.\n Return only the function code, no explanation.",
|
||||
"result": [
|
||||
"function bubbleSort(arr) {\n let sortedArr = [...arr];\n const n = sortedArr.length;\n for (let i = 0; i < n; i++) {\n let swapped = false;\n for (let j = 0; j < n - i - 1; j++) {\n if (sortedArr[j] > sortedArr[j + 1]) {\n let temp = sortedArr[j];\n sortedArr[j] = sortedArr[j + 1];\n sortedArr[j + 1] = temp;\n swapped = true;\n }\n }\n if (!swapped) break;\n }\n return sortedArr;\n}"
|
||||
],
|
||||
"expected": "function bubbleSort(arr) { const n = arr.length; for(let i = 0; i < n; i++) { for(let j = 0; j < n-i-1; j++) { if(arr[j] > arr[j+1]) { [arr[j], arr[j+1]] = [arr[j+1], arr[j]]; } } } return arr; }",
|
||||
"model": "deepseek/deepseek-r1-distill-qwen-14b:free",
|
||||
"router": "deepseek/deepseek-r1-distill-qwen-14b:free",
|
||||
"timestamp": "2025-04-04T13:12:01.405Z",
|
||||
"passed": false,
|
||||
"duration": 14881,
|
||||
"reason": "Expected function bubbleSort(arr) { const n = arr.length; for(let i = 0; i < n; i++) { for(let j = 0; j < n-i-1; j++) { if(arr[j] > arr[j+1]) { [arr[j], arr[j+1]] = [arr[j+1], arr[j]]; } } } return arr; }, but got function bubblesort(arr) {\n let sortedarr = [...arr];\n const n = sortedarr.length;\n for (let i = 0; i < n; i++) {\n let swapped = false;\n for (let j = 0; j < n - i - 1; j++) {\n if (sortedarr[j] > sortedarr[j + 1]) {\n let temp = sortedarr[j];\n sortedarr[j] = sortedarr[j + 1];\n sortedarr[j + 1] = temp;\n swapped = true;\n }\n }\n if (!swapped) break;\n }\n return sortedarr;\n}",
|
||||
"category": "coding"
|
||||
},
|
||||
{
|
||||
"test": "bubble_sort_function",
|
||||
"prompt": "Generate a JavaScript function that implements bubble sort.\n The function should be named 'bubbleSort' and take one parameter 'arr' (an array of numbers).\n The function should return the sorted array.\n Return only the function code, no explanation.",
|
||||
"result": [
|
||||
"function bubbleSort(arr) {\n let n = arr.length;\n for (let i = 0; i < n - 1; i++) {\n for (let j = 0; j < n - 1 - i; j++) {\n if (arr[j] > arr[j + 1]) {\n let temp = arr[j];\n arr[j] = arr[j + 1];\n arr[j + 1] = temp;\n }\n }\n }\n return arr;\n}"
|
||||
],
|
||||
"expected": "function bubbleSort(arr) { const n = arr.length; for(let i = 0; i < n; i++) { for(let j = 0; j < n-i-1; j++) { if(arr[j] > arr[j+1]) { [arr[j], arr[j+1]] = [arr[j+1], arr[j]]; } } } return arr; }",
|
||||
"model": "openai/gpt-4o-mini",
|
||||
"router": "openai/gpt-4o-mini",
|
||||
"timestamp": "2025-04-04T13:12:04.108Z",
|
||||
"passed": false,
|
||||
"duration": 2692,
|
||||
"reason": "Expected function bubbleSort(arr) { const n = arr.length; for(let i = 0; i < n; i++) { for(let j = 0; j < n-i-1; j++) { if(arr[j] > arr[j+1]) { [arr[j], arr[j+1]] = [arr[j+1], arr[j]]; } } } return arr; }, but got function bubblesort(arr) {\n let n = arr.length;\n for (let i = 0; i < n - 1; i++) {\n for (let j = 0; j < n - 1 - i; j++) {\n if (arr[j] > arr[j + 1]) {\n let temp = arr[j];\n arr[j] = arr[j + 1];\n arr[j + 1] = temp;\n }\n }\n }\n return arr;\n}",
|
||||
"category": "coding"
|
||||
},
|
||||
{
|
||||
"test": "bubble_sort_function",
|
||||
"prompt": "Generate a JavaScript function that implements bubble sort.\n The function should be named 'bubbleSort' and take one parameter 'arr' (an array of numbers).\n The function should return the sorted array.\n Return only the function code, no explanation.",
|
||||
"result": [
|
||||
"function bubbleSort(arr) {\n let n = arr.length;\n for (let i = 0; i < n - 1; i++) {\n for (let j = 0; j < n - 1 - i; j++) {\n if (arr[j] > arr[j + 1]) {\n let temp = arr[j];\n arr[j] = arr[j + 1];\n arr[j + 1] = temp;\n }\n }\n }\n return arr;\n}"
|
||||
],
|
||||
"expected": "function bubbleSort(arr) { const n = arr.length; for(let i = 0; i < n; i++) { for(let j = 0; j < n-i-1; j++) { if(arr[j] > arr[j+1]) { [arr[j], arr[j+1]] = [arr[j+1], arr[j]]; } } } return arr; }",
|
||||
"model": "openrouter/quasar-alpha",
|
||||
"router": "openrouter/quasar-alpha",
|
||||
"timestamp": "2025-04-04T13:12:05.773Z",
|
||||
"passed": false,
|
||||
"duration": 1657,
|
||||
"reason": "Expected function bubbleSort(arr) { const n = arr.length; for(let i = 0; i < n; i++) { for(let j = 0; j < n-i-1; j++) { if(arr[j] > arr[j+1]) { [arr[j], arr[j+1]] = [arr[j+1], arr[j]]; } } } return arr; }, but got function bubblesort(arr) {\n let n = arr.length;\n for (let i = 0; i < n - 1; i++) {\n for (let j = 0; j < n - 1 - i; j++) {\n if (arr[j] > arr[j + 1]) {\n let temp = arr[j];\n arr[j] = arr[j + 1];\n arr[j + 1] = temp;\n }\n }\n }\n return arr;\n}",
|
||||
"category": "coding"
|
||||
}
|
||||
],
|
||||
"highscores": [
|
||||
@ -606,14 +816,14 @@
|
||||
"test": "factorial_function",
|
||||
"rankings": [
|
||||
{
|
||||
"model": "openrouter/quasar-alpha",
|
||||
"duration": 948,
|
||||
"duration_secs": 0.948
|
||||
"model": "openai/gpt-3.5-turbo",
|
||||
"duration": 1633,
|
||||
"duration_secs": 1.633
|
||||
},
|
||||
{
|
||||
"model": "openai/gpt-3.5-turbo",
|
||||
"duration": 1187,
|
||||
"duration_secs": 1.187
|
||||
"model": "openai/gpt-4o-mini",
|
||||
"duration": 2574,
|
||||
"duration_secs": 2.574
|
||||
}
|
||||
]
|
||||
},
|
||||
@ -631,7 +841,22 @@
|
||||
"duration_secs": 1.287
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"test": "bubble_sort_function",
|
||||
"rankings": [
|
||||
{
|
||||
"model": "openrouter/quasar-alpha",
|
||||
"duration": 1657,
|
||||
"duration_secs": 1.657
|
||||
},
|
||||
{
|
||||
"model": "openai/gpt-3.5-turbo",
|
||||
"duration": 2181,
|
||||
"duration_secs": 2.181
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"lastUpdated": "2025-04-04T12:52:22.229Z"
|
||||
"lastUpdated": "2025-04-04T13:12:05.774Z"
|
||||
}
|
||||
@ -6,34 +6,91 @@
|
||||
|
||||
| Test | Model | Duration (ms) | Duration (s) |
|
||||
|------|-------|--------------|--------------|
|
||||
| simple_function | openrouter/quasar-alpha | 1425 | 1.43 |
|
||||
| factorial_function | openrouter/quasar-alpha | 948 | 0.95 |
|
||||
| fibonacci_function | openrouter/quasar-alpha | 1287 | 1.29 |
|
||||
| factorial_function | openai/gpt-3.5-turbo | 1633 | 1.63 |
|
||||
| factorial_function | openai/gpt-4o-mini | 2574 | 2.57 |
|
||||
| factorial_function | deepseek/deepseek-r1-distill-qwen-14b:free | 4798 | 4.80 |
|
||||
| factorial_function | openrouter/quasar-alpha | 5237 | 5.24 |
|
||||
| bubble_sort_function | openrouter/quasar-alpha | 1657 | 1.66 |
|
||||
| bubble_sort_function | openai/gpt-3.5-turbo | 2181 | 2.18 |
|
||||
| bubble_sort_function | openai/gpt-4o-mini | 2692 | 2.69 |
|
||||
| bubble_sort_function | deepseek/deepseek-r1-distill-qwen-14b:free | 14881 | 14.88 |
|
||||
|
||||
## Summary
|
||||
|
||||
- Total Tests: 3
|
||||
- Total Tests: 8
|
||||
- Passed: 0
|
||||
- Failed: 3
|
||||
- Failed: 8
|
||||
- Success Rate: 0.00%
|
||||
- Average Duration: 1220ms (1.22s)
|
||||
- Average Duration: 4457ms (4.46s)
|
||||
|
||||
## Failed Tests
|
||||
|
||||
### simple_function - openrouter/quasar-alpha
|
||||
### factorial_function - openai/gpt-3.5-turbo
|
||||
|
||||
- Prompt: `Generate a JavaScript function that adds two numbers and returns the result.
|
||||
The function should be named 'add' and take two parameters 'a' and 'b'.
|
||||
- Prompt: `Generate a JavaScript function that calculates the factorial of a number.
|
||||
The function should be named 'factorial' and take one parameter 'n'.
|
||||
Return only the function code, no explanation.`
|
||||
- Expected: `function add(a, b) { return a + b; }`
|
||||
- Actual: `function add(a, b) {
|
||||
return a + b;
|
||||
- Expected: `function factorial(n) { return n <= 1 ? 1 : n * factorial(n - 1); }`
|
||||
- Actual: `function factorial(n) {
|
||||
if (n === 0 || n === 1) {
|
||||
return 1;
|
||||
} else {
|
||||
return n * factorial(n - 1);
|
||||
}
|
||||
}`
|
||||
- Duration: 1425ms (1.43s)
|
||||
- Reason: Expected function add(a, b) { return a + b; }, but got function add(a, b) {
|
||||
return a + b;
|
||||
- Duration: 1633ms (1.63s)
|
||||
- Reason: Expected function factorial(n) { return n <= 1 ? 1 : n * factorial(n - 1); }, but got function factorial(n) {
|
||||
if (n === 0 || n === 1) {
|
||||
return 1;
|
||||
} else {
|
||||
return n * factorial(n - 1);
|
||||
}
|
||||
}
|
||||
- Timestamp: 4/4/2025, 2:52:19 PM
|
||||
- Timestamp: 4/4/2025, 3:11:31 PM
|
||||
|
||||
### factorial_function - deepseek/deepseek-r1-distill-qwen-14b:free
|
||||
|
||||
- Prompt: `Generate a JavaScript function that calculates the factorial of a number.
|
||||
The function should be named 'factorial' and take one parameter 'n'.
|
||||
Return only the function code, no explanation.`
|
||||
- Expected: `function factorial(n) { return n <= 1 ? 1 : n * factorial(n - 1); }`
|
||||
- Actual: `function factorial(n) {
|
||||
if (n <= 1) return 1;
|
||||
return n * factorial(n - 1);
|
||||
}`
|
||||
- Duration: 4798ms (4.80s)
|
||||
- Reason: Expected function factorial(n) { return n <= 1 ? 1 : n * factorial(n - 1); }, but got function factorial(n) {
|
||||
if (n <= 1) return 1;
|
||||
return n * factorial(n - 1);
|
||||
}
|
||||
- Timestamp: 4/4/2025, 3:11:36 PM
|
||||
|
||||
### factorial_function - openai/gpt-4o-mini
|
||||
|
||||
- Prompt: `Generate a JavaScript function that calculates the factorial of a number.
|
||||
The function should be named 'factorial' and take one parameter 'n'.
|
||||
Return only the function code, no explanation.`
|
||||
- Expected: `function factorial(n) { return n <= 1 ? 1 : n * factorial(n - 1); }`
|
||||
- Actual: `function factorial(n) {
|
||||
if (n < 0) return undefined;
|
||||
if (n === 0 || n === 1) return 1;
|
||||
let result = 1;
|
||||
for (let i = 2; i <= n; i++) {
|
||||
result *= i;
|
||||
}
|
||||
return result;
|
||||
}`
|
||||
- Duration: 2574ms (2.57s)
|
||||
- Reason: Expected function factorial(n) { return n <= 1 ? 1 : n * factorial(n - 1); }, but got function factorial(n) {
|
||||
if (n < 0) return undefined;
|
||||
if (n === 0 || n === 1) return 1;
|
||||
let result = 1;
|
||||
for (let i = 2; i <= n; i++) {
|
||||
result *= i;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
- Timestamp: 4/4/2025, 3:11:39 PM
|
||||
|
||||
### factorial_function - openrouter/quasar-alpha
|
||||
|
||||
@ -47,45 +104,166 @@
|
||||
}
|
||||
return n * factorial(n - 1);
|
||||
}`
|
||||
- Duration: 948ms (0.95s)
|
||||
- Duration: 5237ms (5.24s)
|
||||
- Reason: Expected function factorial(n) { return n <= 1 ? 1 : n * factorial(n - 1); }, but got function factorial(n) {
|
||||
if (n === 0 || n === 1) {
|
||||
return 1;
|
||||
}
|
||||
return n * factorial(n - 1);
|
||||
}
|
||||
- Timestamp: 4/4/2025, 2:52:20 PM
|
||||
- Timestamp: 4/4/2025, 3:11:44 PM
|
||||
|
||||
### fibonacci_function - openrouter/quasar-alpha
|
||||
### bubble_sort_function - openai/gpt-3.5-turbo
|
||||
|
||||
- Prompt: `Generate a JavaScript function that calculates the nth Fibonacci number.
|
||||
The function should be named 'fibonacci' and take one parameter 'n'.
|
||||
- Prompt: `Generate a JavaScript function that implements bubble sort.
|
||||
The function should be named 'bubbleSort' and take one parameter 'arr' (an array of numbers).
|
||||
The function should return the sorted array.
|
||||
Return only the function code, no explanation.`
|
||||
- Expected: `function fibonacci(n) { return n <= 1 ? n : fibonacci(n - 1) + fibonacci(n - 2); }`
|
||||
- Actual: `function fibonacci(n) {
|
||||
if (n <= 0) return 0;
|
||||
if (n === 1) return 1;
|
||||
let a = 0, b = 1;
|
||||
for (let i = 2; i <= n; i++) {
|
||||
let temp = a + b;
|
||||
a = b;
|
||||
b = temp;
|
||||
- Expected: `function bubbleSort(arr) { const n = arr.length; for(let i = 0; i < n; i++) { for(let j = 0; j < n-i-1; j++) { if(arr[j] > arr[j+1]) { [arr[j], arr[j+1]] = [arr[j+1], arr[j]]; } } } return arr; }`
|
||||
- Actual: `function bubbleSort(arr) {
|
||||
let i, j;
|
||||
for (i = 0; i < arr.length-1; i++) {
|
||||
for (j = 0; j < arr.length-i-1; j++) {
|
||||
if (arr[j] > arr[j+1]) {
|
||||
let temp = arr[j];
|
||||
arr[j] = arr[j+1];
|
||||
arr[j+1] = temp;
|
||||
}
|
||||
}
|
||||
}
|
||||
return b;
|
||||
return arr;
|
||||
}`
|
||||
- Duration: 1287ms (1.29s)
|
||||
- Reason: Expected function fibonacci(n) { return n <= 1 ? n : fibonacci(n - 1) + fibonacci(n - 2); }, but got function fibonacci(n) {
|
||||
if (n <= 0) return 0;
|
||||
if (n === 1) return 1;
|
||||
let a = 0, b = 1;
|
||||
for (let i = 2; i <= n; i++) {
|
||||
let temp = a + b;
|
||||
a = b;
|
||||
b = temp;
|
||||
- Duration: 2181ms (2.18s)
|
||||
- Reason: Expected function bubbleSort(arr) { const n = arr.length; for(let i = 0; i < n; i++) { for(let j = 0; j < n-i-1; j++) { if(arr[j] > arr[j+1]) { [arr[j], arr[j+1]] = [arr[j+1], arr[j]]; } } } return arr; }, but got function bubblesort(arr) {
|
||||
let i, j;
|
||||
for (i = 0; i < arr.length-1; i++) {
|
||||
for (j = 0; j < arr.length-i-1; j++) {
|
||||
if (arr[j] > arr[j+1]) {
|
||||
let temp = arr[j];
|
||||
arr[j] = arr[j+1];
|
||||
arr[j+1] = temp;
|
||||
}
|
||||
}
|
||||
}
|
||||
return b;
|
||||
return arr;
|
||||
}
|
||||
- Timestamp: 4/4/2025, 2:52:22 PM
|
||||
- Timestamp: 4/4/2025, 3:11:46 PM
|
||||
|
||||
### bubble_sort_function - deepseek/deepseek-r1-distill-qwen-14b:free
|
||||
|
||||
- Prompt: `Generate a JavaScript function that implements bubble sort.
|
||||
The function should be named 'bubbleSort' and take one parameter 'arr' (an array of numbers).
|
||||
The function should return the sorted array.
|
||||
Return only the function code, no explanation.`
|
||||
- Expected: `function bubbleSort(arr) { const n = arr.length; for(let i = 0; i < n; i++) { for(let j = 0; j < n-i-1; j++) { if(arr[j] > arr[j+1]) { [arr[j], arr[j+1]] = [arr[j+1], arr[j]]; } } } return arr; }`
|
||||
- Actual: `function bubbleSort(arr) {
|
||||
let sortedArr = [...arr];
|
||||
const n = sortedArr.length;
|
||||
for (let i = 0; i < n; i++) {
|
||||
let swapped = false;
|
||||
for (let j = 0; j < n - i - 1; j++) {
|
||||
if (sortedArr[j] > sortedArr[j + 1]) {
|
||||
let temp = sortedArr[j];
|
||||
sortedArr[j] = sortedArr[j + 1];
|
||||
sortedArr[j + 1] = temp;
|
||||
swapped = true;
|
||||
}
|
||||
}
|
||||
if (!swapped) break;
|
||||
}
|
||||
return sortedArr;
|
||||
}`
|
||||
- Duration: 14881ms (14.88s)
|
||||
- Reason: Expected function bubbleSort(arr) { const n = arr.length; for(let i = 0; i < n; i++) { for(let j = 0; j < n-i-1; j++) { if(arr[j] > arr[j+1]) { [arr[j], arr[j+1]] = [arr[j+1], arr[j]]; } } } return arr; }, but got function bubblesort(arr) {
|
||||
let sortedarr = [...arr];
|
||||
const n = sortedarr.length;
|
||||
for (let i = 0; i < n; i++) {
|
||||
let swapped = false;
|
||||
for (let j = 0; j < n - i - 1; j++) {
|
||||
if (sortedarr[j] > sortedarr[j + 1]) {
|
||||
let temp = sortedarr[j];
|
||||
sortedarr[j] = sortedarr[j + 1];
|
||||
sortedarr[j + 1] = temp;
|
||||
swapped = true;
|
||||
}
|
||||
}
|
||||
if (!swapped) break;
|
||||
}
|
||||
return sortedarr;
|
||||
}
|
||||
- Timestamp: 4/4/2025, 3:12:01 PM
|
||||
|
||||
### bubble_sort_function - openai/gpt-4o-mini
|
||||
|
||||
- Prompt: `Generate a JavaScript function that implements bubble sort.
|
||||
The function should be named 'bubbleSort' and take one parameter 'arr' (an array of numbers).
|
||||
The function should return the sorted array.
|
||||
Return only the function code, no explanation.`
|
||||
- Expected: `function bubbleSort(arr) { const n = arr.length; for(let i = 0; i < n; i++) { for(let j = 0; j < n-i-1; j++) { if(arr[j] > arr[j+1]) { [arr[j], arr[j+1]] = [arr[j+1], arr[j]]; } } } return arr; }`
|
||||
- Actual: `function bubbleSort(arr) {
|
||||
let n = arr.length;
|
||||
for (let i = 0; i < n - 1; i++) {
|
||||
for (let j = 0; j < n - 1 - i; j++) {
|
||||
if (arr[j] > arr[j + 1]) {
|
||||
let temp = arr[j];
|
||||
arr[j] = arr[j + 1];
|
||||
arr[j + 1] = temp;
|
||||
}
|
||||
}
|
||||
}
|
||||
return arr;
|
||||
}`
|
||||
- Duration: 2692ms (2.69s)
|
||||
- Reason: Expected function bubbleSort(arr) { const n = arr.length; for(let i = 0; i < n; i++) { for(let j = 0; j < n-i-1; j++) { if(arr[j] > arr[j+1]) { [arr[j], arr[j+1]] = [arr[j+1], arr[j]]; } } } return arr; }, but got function bubblesort(arr) {
|
||||
let n = arr.length;
|
||||
for (let i = 0; i < n - 1; i++) {
|
||||
for (let j = 0; j < n - 1 - i; j++) {
|
||||
if (arr[j] > arr[j + 1]) {
|
||||
let temp = arr[j];
|
||||
arr[j] = arr[j + 1];
|
||||
arr[j + 1] = temp;
|
||||
}
|
||||
}
|
||||
}
|
||||
return arr;
|
||||
}
|
||||
- Timestamp: 4/4/2025, 3:12:04 PM
|
||||
|
||||
### bubble_sort_function - openrouter/quasar-alpha
|
||||
|
||||
- Prompt: `Generate a JavaScript function that implements bubble sort.
|
||||
The function should be named 'bubbleSort' and take one parameter 'arr' (an array of numbers).
|
||||
The function should return the sorted array.
|
||||
Return only the function code, no explanation.`
|
||||
- Expected: `function bubbleSort(arr) { const n = arr.length; for(let i = 0; i < n; i++) { for(let j = 0; j < n-i-1; j++) { if(arr[j] > arr[j+1]) { [arr[j], arr[j+1]] = [arr[j+1], arr[j]]; } } } return arr; }`
|
||||
- Actual: `function bubbleSort(arr) {
|
||||
let n = arr.length;
|
||||
for (let i = 0; i < n - 1; i++) {
|
||||
for (let j = 0; j < n - 1 - i; j++) {
|
||||
if (arr[j] > arr[j + 1]) {
|
||||
let temp = arr[j];
|
||||
arr[j] = arr[j + 1];
|
||||
arr[j + 1] = temp;
|
||||
}
|
||||
}
|
||||
}
|
||||
return arr;
|
||||
}`
|
||||
- Duration: 1657ms (1.66s)
|
||||
- Reason: Expected function bubbleSort(arr) { const n = arr.length; for(let i = 0; i < n; i++) { for(let j = 0; j < n-i-1; j++) { if(arr[j] > arr[j+1]) { [arr[j], arr[j+1]] = [arr[j+1], arr[j]]; } } } return arr; }, but got function bubblesort(arr) {
|
||||
let n = arr.length;
|
||||
for (let i = 0; i < n - 1; i++) {
|
||||
for (let j = 0; j < n - 1 - i; j++) {
|
||||
if (arr[j] > arr[j + 1]) {
|
||||
let temp = arr[j];
|
||||
arr[j] = arr[j + 1];
|
||||
arr[j + 1] = temp;
|
||||
}
|
||||
}
|
||||
}
|
||||
return arr;
|
||||
}
|
||||
- Timestamp: 4/4/2025, 3:12:05 PM
|
||||
|
||||
## Passed Tests
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user