From cfd970e21663c3278f6e01d356690789225b6b56 Mon Sep 17 00:00:00 2001 From: Elizabeth Hunt Date: Sat, 2 Dec 2023 14:16:56 -0700 Subject: 2022 day 9 and add utils --- aoc_2022/day-09/example.test.ts | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 aoc_2022/day-09/example.test.ts (limited to 'aoc_2022/day-09/example.test.ts') diff --git a/aoc_2022/day-09/example.test.ts b/aoc_2022/day-09/example.test.ts new file mode 100644 index 0000000..8fea0c3 --- /dev/null +++ b/aoc_2022/day-09/example.test.ts @@ -0,0 +1,33 @@ +import { expect, test } from "bun:test"; +import { main as part1 } from "./part_1"; +import { main as part2 } from "./part_2"; + +const example = `R 4 +U 4 +L 3 +D 1 +R 4 +D 1 +L 5 +R 2`.split("\n"); +const example2 = `R 5 +U 8 +L 8 +D 3 +R 17 +D 10 +L 25 +U 20`.split("\n"); +//const example = `1 2 3 4 5`.split(" "); + +test("part1", async () => { + const answer = 13; + const res = await part1(example); + expect(res).toEqual(answer); +}); + +test("part2", async () => { + const answer = 36; + const res = await part2(example2); + expect(res).toEqual(answer); +}); -- cgit v1.2.3-70-g09d2