|
@ -2,19 +2,29 @@ module Main (main) where |
|
|
import Test.Hspec |
|
|
import Test.Hspec |
|
|
import Day1 |
|
|
import Day1 |
|
|
import Day2 |
|
|
import Day2 |
|
|
|
|
|
import Day3 |
|
|
|
|
|
|
|
|
main :: IO () |
|
|
main :: IO () |
|
|
main = do |
|
|
main = do |
|
|
day1in <- readFile "test/1.testcase" |
|
|
|
|
|
day2in <- readFile "test/2.testcase" |
|
|
|
|
|
hspec $ do |
|
|
hspec $ do |
|
|
describe "Day1" $ do |
|
|
describe "Day1" $ do |
|
|
it "solves part 1" $ do |
|
|
it "solves part 1" $ do |
|
|
Day1.part1 day1in `shouldBe` "11" |
|
|
|
|
|
|
|
|
input <- readFile "test/1" |
|
|
|
|
|
Day1.part1 input `shouldBe` "11" |
|
|
it "solves part 2" $ do |
|
|
it "solves part 2" $ do |
|
|
Day1.part2 day1in `shouldBe` "31" |
|
|
|
|
|
|
|
|
input <- readFile "test/1" |
|
|
|
|
|
Day1.part2 input `shouldBe` "31" |
|
|
describe "Day 2" $ do |
|
|
describe "Day 2" $ do |
|
|
it "solves part 1" $ do |
|
|
it "solves part 1" $ do |
|
|
Day2.part1 day2in `shouldBe` "2" |
|
|
|
|
|
|
|
|
input <- readFile "test/2" |
|
|
|
|
|
Day2.part1 input `shouldBe` "2" |
|
|
it "solves part 2" $ do |
|
|
it "solves part 2" $ do |
|
|
Day2.part2 day2in `shouldBe` "4" |
|
|
|
|
|
|
|
|
input <- readFile "test/2" |
|
|
|
|
|
Day2.part2 input `shouldBe` "4" |
|
|
|
|
|
describe "Day 3" $ do |
|
|
|
|
|
it "solves part 1" $ do |
|
|
|
|
|
input <- readFile "test/3.1" |
|
|
|
|
|
Day3.part1 input `shouldBe` "161" |
|
|
|
|
|
it "solves part 2" $ do |
|
|
|
|
|
input <- readFile "test/3.2" |
|
|
|
|
|
Day3.part2 input `shouldBe` "48" |