diff --git a/test/1.testcase b/test/1.testcase new file mode 100644 index 0000000..b8af9ad --- /dev/null +++ b/test/1.testcase @@ -0,0 +1,6 @@ +3 4 +4 3 +2 5 +1 3 +3 9 +3 3 diff --git a/test/2.testcase b/test/2.testcase new file mode 100644 index 0000000..b49c10d --- /dev/null +++ b/test/2.testcase @@ -0,0 +1,6 @@ +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 diff --git a/test/Main.hs b/test/Main.hs index 7310eb3..9936239 100644 --- a/test/Main.hs +++ b/test/Main.hs @@ -4,14 +4,17 @@ import Day1 import Day2 main :: IO () -main = hspec $ do - describe "Day1" $ do - it "solves part 1" $ do - Day1.part1 "3 4\n4 3\n2 5\n1 3\n3 9\n3 3\n" `shouldBe` "11" - it "solves part 2" $ do - Day1.part2 "3 4\n4 3\n2 5\n1 3\n3 9\n3 3\n" `shouldBe` "31" - describe "Day 2" $ do - it "solves part 1" $ do - Day2.part1 "7 6 4 2 1\n1 2 7 8 9\n9 7 6 2 1\n1 3 2 4 5\n8 6 4 4 1\n1 3 6 7 9" `shouldBe` "2" - it "solves part 2" $ do - Day2.part2 "7 6 4 2 1\n1 2 7 8 9\n9 7 6 2 1\n1 3 2 4 5\n8 6 4 4 1\n1 3 6 7 9" `shouldBe` "4" +main = do + day1in <- readFile "test/1.testcase" + day2in <- readFile "test/2.testcase" + hspec $ do + describe "Day1" $ do + it "solves part 1" $ do + Day1.part1 day1in `shouldBe` "11" + it "solves part 2" $ do + Day1.part2 day1in `shouldBe` "31" + describe "Day 2" $ do + it "solves part 1" $ do + Day2.part1 day2in `shouldBe` "2" + it "solves part 2" $ do + Day2.part2 day2in `shouldBe` "4"