2024 day 12

This commit is contained in:
2024-12-12 23:05:57 +01:00
parent f497ad035b
commit 545b8c9259
5 changed files with 355 additions and 1 deletions

41
2024/day-12/day12.test.ts Normal file
View File

@@ -0,0 +1,41 @@
import { expect, test } from "bun:test";
import * as path from "node:path";
import { part1, part2 } from "./day12.ts";
test("day 12, part 1", async () => {
const testInput = await Bun.file(
path.resolve(__dirname, "test-input.txt"),
).text();
const input = await Bun.file(path.resolve(__dirname, "input.txt")).text();
console.log("\n\n");
const testResult = part1(testInput);
console.log("Test data:", testResult);
expect(testResult).toEqual(1930);
// const finalResult = part1(input);
// console.log("Full data:", finalResult);
// expect(finalResult).toEqual(1424472);
console.log("\n\n");
});
test("day 12, part 2", async () => {
const testInput = await Bun.file(
path.resolve(__dirname, "test-input.txt"),
).text();
const input = await Bun.file(path.resolve(__dirname, "input.txt")).text();
// const testResult = part2(testInput);
// console.log("\n\n");
// console.log("Test data:", testResult);
// expect(testResult).toEqual(1206);
const finalResult = part2(input);
console.log("Full data:", finalResult);
expect(finalResult).toEqual(0);
expect(finalResult).not.toEqual(866276);
console.log("\n\n");
});