2021-12-10 15:25:34 +00:00
|
|
|
// https://adventofcode.com/2021/day/09
|
|
|
|
|
|
|
|
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) => {
|
|
|
|
t.match(p1.genNeighbours(10,10)(0,0), [
|
|
|
|
[1,0],[0,1]
|
|
|
|
]);
|
|
|
|
t.equal(p1.solution(await sample), 15);
|
|
|
|
t.equal(p1.solution(await input), 550);
|
|
|
|
});
|
|
|
|
|
|
|
|
tap.test("part2", async (t) => {
|
2021-12-10 17:16:34 +00:00
|
|
|
t.equal(p2.solution(await sample), 1134);
|
|
|
|
t.equal(p2.solution(await input), 1100682);
|
2021-12-10 15:25:34 +00:00
|
|
|
});
|