adventofcode/2021/10/test.mjs

24 lines
608 B
JavaScript
Raw Permalink Normal View History

2021-12-10 17:39:02 +00:00
// https://adventofcode.com/2021/day/10
import tap from "tap";
import fs from "fs-extra";
import * as p1 from "./part1.mjs";
import * as p2 from "./part2.mjs";
const sample = p1.processInput('sample');
const input = p1.processInput('input');
tap.test("part1", async (t) => {
2021-12-10 18:35:49 +00:00
t.equal(p1.solution(await sample), 26397);
t.equal(p1.solution(await input), 311949);
2021-12-10 17:39:02 +00:00
});
tap.test("part2", async (t) => {
2021-12-10 18:35:49 +00:00
t.match(p2.linesScore(await sample), [
288957, 5566, 1480781, 995444, 294
]);
t.equal(p2.solution(await sample), 288957);
t.equal(p2.solution(await input), 3042730309);
2021-12-10 17:39:02 +00:00
});