adventofcode/2022/12/test.js

29 lines
721 B
JavaScript

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", () => {
test("findStart", () => {
expect(findStart(sample).toArray()).toEqual([0, 0]);
});
test("sample", () => {
expect(part1(sample)).toEqual(31);
});
test("solution", () => {
const r = part1(puzzleInput);
expect(r).toBeLessThan(9999);
expectSolution(r).toEqual(361);
});
});
describe.only("part 2", () => {
test("sample", () => {
expect(part2(sample)).toEqual(29);
});
test("solution", () => {
expectSolution(part2(puzzleInput)).toEqual(354);
});
});