From 7ed0b15f5413244c226d958d6a6a80bea10b2c28 Mon Sep 17 00:00:00 2001 From: multipleof4 Date: Thu, 13 Nov 2025 16:45:26 -0800 Subject: [PATCH] Refactor: Export test case inputs for debug page --- tests/4_determinant/test.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tests/4_determinant/test.js b/tests/4_determinant/test.js index 5fc9542..e09a43a 100644 --- a/tests/4_determinant/test.js +++ b/tests/4_determinant/test.js @@ -5,13 +5,16 @@ export default { // - You MUST use a dynamic import() to load the 'mathjs' library from a CDN. // - You MUST use the library's built-in 'det' function to perform the calculation. // - The function should return the determinant value.`, + getTestCases: () => { + const matrix = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]; + return [matrix]; + }, runTest: async (calculateDeterminant) => { const assert = { strictEqual: (a, e, m) => { if (a !== e) throw new Error(m || `FAIL: ${a} !== ${e}`) }, }; - const matrix = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]; + const [matrix] = globalThis.getTestCases ? globalThis.getTestCases() : this.getTestCases(); const det = await calculateDeterminant(matrix); assert.strictEqual(det, 0, "Test Failed: Determinant should be 0."); } }; -