2022-12-11 18:30:44 +00:00
|
|
|
import { test, expect, describe } from "vitest";
|
|
|
|
|
|
|
|
import { expectSolution } from "../01/main.js";
|
|
|
|
import part1, { sample, puzzleInput } from "./part1.js";
|
|
|
|
import part2 from "./part2.js";
|
|
|
|
|
|
|
|
describe("part 1", () => {
|
2022-12-12 00:32:35 +00:00
|
|
|
test("readInput", () => {
|
|
|
|
expect(sample[0]).toMatchObject({ divisible: 23, items: [79, 98] });
|
|
|
|
});
|
|
|
|
test("sample", () => {
|
|
|
|
expect(part1(sample)).toEqual(10605);
|
|
|
|
});
|
2022-12-11 18:30:44 +00:00
|
|
|
test("solution", () => {
|
|
|
|
expectSolution(part1(puzzleInput)).toEqual(58794);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
describe.only("part 2", () => {
|
2022-12-12 00:32:35 +00:00
|
|
|
test.skip("sample", () => {
|
|
|
|
expect(part2(sample)).toEqual(2713310158);
|
|
|
|
});
|
2022-12-11 18:30:44 +00:00
|
|
|
test("solution", () => {
|
|
|
|
expectSolution(part2(puzzleInput)).toBeLessThan(32239420356);
|
|
|
|
expectSolution(part2(puzzleInput)).toEqual(20151213744);
|
|
|
|
});
|
|
|
|
});
|