From 788e01b7bb34de5101f60a859129724265c22c2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Geron?= Date: Sat, 7 Dec 2024 12:39:09 +1300 Subject: [PATCH] Add unit tests --- test/aoc2024_test.exs | 32 +++++++++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-) diff --git a/test/aoc2024_test.exs b/test/aoc2024_test.exs index 5e6660c..8308a1b 100644 --- a/test/aoc2024_test.exs +++ b/test/aoc2024_test.exs @@ -1,8 +1,34 @@ defmodule Aoc2024Test do use ExUnit.Case - doctest Aoc2024 + # doctest Aoc2024 - test "greets the world" do - assert Aoc2024.hello() == :world + test "Day 1" do + parsed_input = + Aoc2024.Day01.parse(""" + 3 4 + 4 3 + 2 5 + 1 3 + 3 9 + 3 3 + """) + + assert Aoc2024.Day01.part1(parsed_input) == 11 + assert Aoc2024.Day01.part2(parsed_input) == 31 + end + + test "Day 2" do + parsed_input = + Aoc2024.Day02.parse(""" + 7 6 4 2 1 + 1 2 7 8 9 + 9 7 6 2 1 + 1 3 2 4 5 + 8 6 4 4 1 + 1 3 6 7 9 + """) + + assert Aoc2024.Day02.part1(parsed_input) == 2 + assert Aoc2024.Day02.part2(parsed_input) == 4 end end