adventofcode/2022/12/test.js

29 lines
721 B
JavaScript
Raw Normal View History

2022-12-12 17:33:12 +00:00
import { test, expect, describe } from "vitest";
import { expectSolution } from "../01/main.js";
import part1, { findStart, sample, puzzleInput } from "./part1.js";
import part2 from "./part2.js";
describe("part 1", () => {
2022-12-13 01:52:48 +00:00
test("findStart", () => {
expect(findStart(sample).toArray()).toEqual([0, 0]);
});
2022-12-14 14:25:59 +00:00
test("sample", () => {
2022-12-13 01:52:48 +00:00
expect(part1(sample)).toEqual(31);
});
2022-12-14 15:40:27 +00:00
test("solution", () => {
const r = part1(puzzleInput);
expect(r).toBeLessThan(9999);
2022-12-13 01:52:48 +00:00
expectSolution(r).toEqual(361);
2022-12-12 17:33:12 +00:00
});
});
2022-12-14 14:25:59 +00:00
describe.only("part 2", () => {
test("sample", () => {
expect(part2(sample)).toEqual(29);
});
test("solution", () => {
expectSolution(part2(puzzleInput)).toEqual(354);
2022-12-12 17:33:12 +00:00
});
});