-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathday05.test.ts
55 lines (48 loc) · 919 Bytes
/
day05.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
52
53
54
55
import { describe, expect, it } from 'vitest';
import { DayImpl, reorderUpdate } from './day05.ts';
const sample = `47|53
97|13
97|61
97|47
75|29
61|13
75|53
29|13
97|29
53|29
61|53
97|53
61|29
47|13
75|47
97|75
47|61
75|61
47|29
75|13
53|13
75,47,61,53,29
97,61,53,29,13
75,29,13
75,97,47,61,53
61,13,29
97,13,75,29,47`;
describe('day05', () => {
describe('partOne', () => {
it('should return', () => {
expect(new DayImpl(sample).partOne()).toEqual(143);
});
});
describe('partTwo', () => {
it('should return', () => {
expect(new DayImpl(sample).partTwo()).toEqual(123);
});
});
describe('#reorderUpdate', () => {
it('should reorder', () => {
const parsedInput = new DayImpl(sample).input;
const result = reorderUpdate([75, 97, 47, 61, 53], parsedInput.before, parsedInput.after);
expect(result).toStrictEqual([97, 75, 47, 61, 53]);
});
});
});