-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.test.ts
23 lines (20 loc) · 850 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
import assert from 'node:assert/strict';
import { describe, it } from 'node:test';
import { getInput } from '../../../utils/file.ts';
import { part1, part2 } from './index.ts';
const input = (await getInput(import.meta.dirname)).split('\n');
const sampleInput = ['forward 5', 'down 5', 'forward 8', 'up 3', 'down 8', 'forward 2'];
describe('2021 Day 2', () => {
describe('Part 1', () => {
it('should calculate the horizontal position and depth after following the course', () => {
assert.strictEqual(part1(sampleInput), 150);
assert.strictEqual(part1(input), 1962940);
});
});
describe('Part 2', () => {
it('should calculate the horizontal position and depth after following the course', () => {
assert.strictEqual(part2(sampleInput), 900);
assert.strictEqual(part2(input), 1813664422);
});
});
});