|
| 1 | +import { part1, part2 } from "./day10.js"; |
| 2 | +import { describe, test, expect } from "vitest"; |
| 3 | +import readInput from "../utils/read-input.js"; |
| 4 | + |
| 5 | +let input = readInput(import.meta.url); |
| 6 | + |
| 7 | +describe("day10 2025", () => { |
| 8 | + describe("part1", () => { |
| 9 | + test("it should work for part 1 examples", () => { |
| 10 | + expect( |
| 11 | + part1( |
| 12 | + [ |
| 13 | + "[.##.] (3) (1,3) (2) (2,3) (0,2) (0,1) {3,5,4,7}", |
| 14 | + "[...#.] (0,2,3,4) (2,3) (0,4) (0,1,2) (1,2,3,4) {7,5,12,7,2}", |
| 15 | + "[.###.#] (0,1,2,3,4) (0,3,4) (0,1,2,4,5) (1,2) {10,11,11,5,10,5}", |
| 16 | + ].join("\n"), |
| 17 | + ), |
| 18 | + ).toEqual(7); |
| 19 | + }); |
| 20 | + |
| 21 | + test("it should work for part 1 input", () => { |
| 22 | + expect(part1(input)).toEqual(409); |
| 23 | + }); |
| 24 | + }); |
| 25 | + |
| 26 | + describe("part2", () => { |
| 27 | + test("it should work for part 2 examples", () => { |
| 28 | + expect( |
| 29 | + part2( |
| 30 | + [ |
| 31 | + "[.##.] (3) (1,3) (2) (2,3) (0,2) (0,1) {3,5,4,7}", |
| 32 | + "[...#.] (0,2,3,4) (2,3) (0,4) (0,1,2) (1,2,3,4) {7,5,12,7,2}", |
| 33 | + "[.###.#] (0,1,2,3,4) (0,3,4) (0,1,2,4,5) (1,2) {10,11,11,5,10,5}", |
| 34 | + ].join("\n"), |
| 35 | + ), |
| 36 | + ).toEqual(33); |
| 37 | + }); |
| 38 | + |
| 39 | + test.skip("it should work for part 2 input", () => { |
| 40 | + expect(part2(input)).toEqual(0); // solved with z3, will implement in code later |
| 41 | + }); |
| 42 | + }); |
| 43 | +}); |
0 commit comments