added some tests

This commit is contained in:
Yann Esposito (Yogsototh) 2017-12-06 23:19:26 +01:00
parent 8f997939bc
commit e028ff3f3e
Signed by untrusted user who does not match committer: yogsototh
GPG key ID: 7B19A4C650D59646

View file

@ -3,6 +3,9 @@ import Test.Tasty.HUnit
import qualified Day1
import qualified Day2
import qualified Day5
import qualified Day6
import Control.Monad (when)
main :: IO ()
main = defaultMain $
@ -29,4 +32,32 @@ main = defaultMain $
, testCase "example problem 2" $
Day2.solution2 [[5,9,2,8],[9,4,7,3],[3,8,6,5]] @?= 9
]
, testGroup "Day 5"
[ testCaseSteps "example problem 1" $ \step -> do
step "Loading input"
input <- Day5.testArray
step "Running solution 1"
sol1 <- Day5.solution1 input
when (sol1 /= 5) (assertFailure "Should be 5 steps")
, testCaseSteps "example problem 2" $ \step -> do
step "Loading input"
input <- Day5.testArray
step "Running solution 2"
sol2 <- Day5.solution2 input
when (sol2 /= 10) (assertFailure "Day 6 solution 2 on the example should be 4")
]
, testGroup "Day 6"
[ testCaseSteps "example problem 1" $ \step -> do
step "Loading input"
input <- Day6.testArray
step "Running solution 1"
sol1 <- Day6.solution1 input
when (sol1 /= 5) (assertFailure "Should be 5 steps")
, testCaseSteps "example problem 2" $ \step -> do
step "Loading input"
input <- Day6.testArray
step "Running solution 2"
sol2 <- Day6.solution2 input
when (sol2 /= 4) (assertFailure "Day 6 solution 2 on the example should be 4")
]
]