-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.test.ts
31 lines (26 loc) · 1001 Bytes
/
index.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
import assert from 'node:assert/strict';
import { describe, it } from 'node:test';
import { part1, part2 } from './index.ts';
const input = [1, 20, 11, 6, 12, 0];
describe('Day 15', () => {
describe('Part 1', () => {
it('should return spoken number at position `2020`', () => {
const n = 2020;
assert.strictEqual(part1([0, 3, 6], n), 436);
assert.strictEqual(part1(input, n), 1085);
});
});
describe.skip('Part 2', () => {
it('should return spoken number at position `30000000`', () => {
const n = 30000000;
assert.strictEqual(part2([0, 3, 6], n), 175594);
assert.strictEqual(part2([1, 3, 2], n), 2578);
assert.strictEqual(part2([2, 1, 3], n), 3544142);
assert.strictEqual(part2([1, 2, 3], n), 261214);
assert.strictEqual(part2([2, 3, 1], n), 6895259);
assert.strictEqual(part2([3, 2, 1], n), 18);
assert.strictEqual(part2([3, 1, 2], n), 362);
assert.strictEqual(part2(input, n), 10652);
});
});
});