deno.land / x / masx200_leetcode_test@10.6.5 / group-the-people-given-the-group-size-they-belong-to / test.ts

نووسراو ببینە
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import { assertEquals } from "https://deno.land/std@0.157.0/testing/asserts.ts";
import { sum } from "../richest-customer-wealth/sum.ts";import groupThePeople from "./index.ts";
Deno.test("group-the-people-given-the-group-size-they-belong-to", () => { const inputs = [ [3, 3, 3, 3, 3, 1, 3], [2, 1, 3, 3, 3, 2], ]; const results = inputs.map(groupThePeople);
results.forEach((result, i) => { const input = inputs[i]; // console.log(`input: ${inputs[i]}`); // console.log(`result: ${result}`);
assertEquals(input.length, sum(result.map((a) => a.length)));
for (const arr of result) { for (const i of arr) { assertEquals(arr.length, input[i]); } } });});Deno.test("group-the-people-given-the-group-size-they-belong-to", () => { const inputs = [ [3, 3, 3, 3, 3, 1, 3], [2, 1, 3, 3, 3, 2], ]; const results = [ [[5], [0, 1, 2], [3, 4, 6]], [[1], [0, 5], [2, 3, 4]], ];
results.forEach((result, i) => { const input = inputs[i]; // console.log(`input: ${inputs[i]}`); // console.log(`result: ${result}`);
assertEquals(input.length, sum(result.map((a) => a.length)));
for (const arr of result) { for (const i of arr) { assertEquals(arr.length, input[i]); } } });});
masx200_leetcode_test

Version Info

Tagged at
a year ago