-
Notifications
You must be signed in to change notification settings - Fork 0
/
17.spec.ts
109 lines (101 loc) · 1.87 KB
/
17.spec.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
import { test, expectTypeOf, expect, describe } from 'vitest'
import { optimizeIntervals } from '../challenges/17'
describe('Challenge #17', () => {
test('Test #01', () => {
expectTypeOf(optimizeIntervals).returns.toEqualTypeOf([])
})
test('Test #02', () => {
const received = optimizeIntervals([[2, 7], [3, 4], [5, 8]])
const expected = [
[
2,
8
]
]
expect(received).toEqual(expected)
})
test('Test #03', () => {
const received = optimizeIntervals([[3, 4], [5, 8], [2, 7]])
const expected = [
[
2,
8
]
]
expect(received).toEqual(expected)
})
test('Test #04', () => {
const received = optimizeIntervals([[1, 3], [2, 6], [8, 10]])
const expected = [
[
1,
6
],
[
8,
10
]
]
expect(received).toEqual(expected)
})
test('Test #05', () => {
const received = optimizeIntervals([[1, 2], [3, 4], [5, 6]])
const expected = [
[
1,
2
],
[
3,
4
],
[
5,
6
]
]
expect(received).toEqual(expected)
})
test('Test #06', () => {
const received = optimizeIntervals([[5, 7], [6, 8]])
const expected = [
[
5,
8
]
]
expect(received).toEqual(expected)
})
test('Test #07', () => {
const received = optimizeIntervals([[1, 5], [6, 10], [11, 15], [16, 20]])
const expected = [
[
1,
5
],
[
6,
10
],
[
11,
15
],
[
16,
20
]
]
expect(received).toEqual(expected)
})
test('Test #08', () => {
const received = optimizeIntervals([[1, 15], [8, 12], [4, 7]])
const expected = [
[
1,
15
]
]
expect(received).toEqual(expected)
})
})