|
|
@ -4,14 +4,17 @@ import Day1 |
|
|
|
import Day2 |
|
|
|
|
|
|
|
main :: IO () |
|
|
|
main = hspec $ do |
|
|
|
main = do |
|
|
|
day1in <- readFile "test/1.testcase" |
|
|
|
day2in <- readFile "test/2.testcase" |
|
|
|
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" |
|
|
|
Day1.part1 day1in `shouldBe` "11" |
|
|
|
it "solves part 2" $ do |
|
|
|
Day1.part2 "3 4\n4 3\n2 5\n1 3\n3 9\n3 3\n" `shouldBe` "31" |
|
|
|
Day1.part2 day1in `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" |
|
|
|
Day2.part1 day2in `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" |
|
|
|
Day2.part2 day2in `shouldBe` "4" |