|
1 |
| -import { assertEquals } from "../deps.ts"; |
2 |
| -import { mergeSortedArray } from "../mod.ts"; |
3 |
| -Deno.test("merge-sorted-array", () => { |
4 |
| - const examples: { |
5 |
| - input: Parameters<typeof mergeSortedArray>; |
6 |
| - output: Parameters<typeof mergeSortedArray>[0]; |
7 |
| - }[] = [ |
8 |
| - { |
9 |
| - input: [[1, 2, 3, 0, 0, 0], 3, [2, 5, 6], 3], |
10 |
| - output: [1, 2, 2, 3, 5, 6], |
11 |
| - }, |
12 |
| - { input: [[1], 1, [], 0], output: [1] }, |
13 |
| - { input: [[0], 0, [1], 1], output: [1] }, |
14 |
| - ]; |
15 |
| - examples.forEach(({ input, output }) => { |
16 |
| - mergeSortedArray(...input); |
17 |
| - assertEquals(output, input[0]); |
18 |
| - }); |
19 |
| -}); |
| 1 | +import { assertEquals } from "../deps.ts"; |
| 2 | +import { mergeSortedArray } from "../mod.ts"; |
| 3 | +Deno.test("merge-sorted-array", () => { |
| 4 | + const examples: { |
| 5 | + input: Parameters<typeof mergeSortedArray>; |
| 6 | + output: Parameters<typeof mergeSortedArray>[0]; |
| 7 | + }[] = [ |
| 8 | + { |
| 9 | + input: [[1, 2, 3, 0, 0, 0], 3, [2, 5, 6], 3], |
| 10 | + output: [1, 2, 2, 3, 5, 6], |
| 11 | + }, |
| 12 | + { input: [[1], 1, [], 0], output: [1] }, |
| 13 | + { input: [[0], 0, [1], 1], output: [1] }, |
| 14 | + ]; |
| 15 | + examples.forEach(({ input, output }) => { |
| 16 | + mergeSortedArray(...input); |
| 17 | + assertEquals(output, input[0]); |
| 18 | + }); |
| 19 | +}); |
0 commit comments