Revert: Update test.js

This commit is contained in:
2025-11-13 16:49:27 -08:00
parent 53833b2084
commit d33b11c8fd

View File

@@ -5,16 +5,14 @@ export default {
// - You MUST implement the efficient O(n log n) algorithm. // - You MUST implement the efficient O(n log n) algorithm.
// - You MUST use a dynamic import() to load the 'd3-array' library from a CDN and use its 'bisectLeft' function to achieve O(n log n) complexity. // - You MUST use a dynamic import() to load the 'd3-array' library from a CDN and use its 'bisectLeft' function to achieve O(n log n) complexity.
// - The function should return a single number: the length of the LIS.`, // - The function should return a single number: the length of the LIS.`,
getTestCases: () => {
const nums = [10, 9, 2, 5, 3, 7, 101, 18, 4, 6];
return [nums];
},
runTest: async (findLISLength) => { runTest: async (findLISLength) => {
const assert = { const assert = {
strictEqual: (a, e, m) => { if (a !== e) throw new Error(m || `FAIL: ${a} !== ${e}`) }, strictEqual: (a, e, m) => { if (a !== e) throw new Error(m || `FAIL: ${a} !== ${e}`) },
}; };
const [nums] = globalThis.getTestCases ? globalThis.getTestCases() : this.getTestCases(); const nums = [10, 9, 2, 5, 3, 7, 101, 18, 4, 6];
const length = await findLISLength(nums); const length = await findLISLength(nums);
assert.strictEqual(length, 4, "Test Failed: LIS length should be 4."); assert.strictEqual(length, 4, "Test Failed: LIS length should be 4.");
} }
}; };