summaryrefslogtreecommitdiff
path: root/aoc_2022/day-09/example.test.ts
diff options
context:
space:
mode:
authorElizabeth Hunt <elizabeth.hunt@simponic.xyz>2023-12-02 14:16:56 -0700
committerElizabeth Hunt <elizabeth.hunt@simponic.xyz>2023-12-02 14:16:56 -0700
commitcfd970e21663c3278f6e01d356690789225b6b56 (patch)
treea868659cc8425cc47ba1cd02509b3fe80632039c /aoc_2022/day-09/example.test.ts
parent118fc144884f0d716cc03e877aa85f83d289cec8 (diff)
downloadaoc-cfd970e21663c3278f6e01d356690789225b6b56.tar.gz
aoc-cfd970e21663c3278f6e01d356690789225b6b56.zip
2022 day 9 and add utils
Diffstat (limited to 'aoc_2022/day-09/example.test.ts')
-rw-r--r--aoc_2022/day-09/example.test.ts33
1 files changed, 33 insertions, 0 deletions
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);
+});