-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlonely-integer.test.ts
More file actions
54 lines (51 loc) · 1.49 KB
/
Copy pathlonely-integer.test.ts
File metadata and controls
54 lines (51 loc) · 1.49 KB
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
52
53
54
import { Input, lonelyInteger, Output } from "../lonely-integer";
type Cases = [Input, Output][];
describe("Lonely Integer", () => {
const cases: Cases = [
[[1], 1],
[[1, 1, 2], 2],
[[0, 0, 1, 2, 1], 2],
[[4, 9, 95, 93, 57, 4, 57, 93, 9], 95],
[
[
34, 95, 34, 64, 45, 95, 16, 80, 80, 75, 3, 25, 75, 25, 31, 3, 64, 16,
31,
],
45,
],
[
[
15, 60, 74, 1, 94, 93, 28, 48, 70, 98, 45, 94, 42, 45, 48, 1, 72, 9, 24,
93, 41, 70, 60, 28, 11, 20, 72, 35, 11, 98, 31, 74, 31, 41, 9, 42, 20,
35, 24,
],
15,
],
[
[
18, 49, 15, 30, 56, 20, 49, 67, 82, 69, 84, 63, 93, 87, 66, 17, 38, 32,
17, 32, 94, 66, 67, 63, 48, 64, 84, 82, 87, 18, 79, 64, 79, 15, 71, 94,
59, 5, 22, 59, 4, 98, 81, 4, 98, 73, 69, 88, 30, 81, 48, 56, 71, 20, 93,
22, 73, 5, 88,
],
38,
],
[
[
59, 88, 14, 8, 85, 1, 94, 74, 57, 96, 39, 2, 47, 43, 35, 17, 53, 52, 92,
31, 99, 48, 94, 30, 92, 60, 32, 45, 88, 13, 39, 50, 22, 65, 89, 46, 65,
76, 57, 67, 99, 35, 76, 46, 85, 82, 45, 62, 53, 80, 74, 22, 31, 52, 82,
13, 41, 96, 2, 1, 80, 62, 4, 20, 50, 89, 59, 67, 60, 8, 41, 14, 47, 48,
17, 4, 43, 30, 32,
],
20,
],
];
test.each(cases)(
"for given array of integers %j output should be %d",
(firstArg, expectedResult) => {
const result = lonelyInteger(firstArg);
expect(result).toEqual(expectedResult);
}
);
});