Make test tree reflect directory tree
This commit is contained in:
parent
0d236a2f2c
commit
60acecb993
19
app/Main.hs
19
app/Main.hs
@ -23,18 +23,17 @@ main =
|
|||||||
defaultMain
|
defaultMain
|
||||||
. localOption (Always :: UseColor)
|
. localOption (Always :: UseColor)
|
||||||
. testGroup "tests"
|
. testGroup "tests"
|
||||||
$ map
|
$ ["examples", "real"] <&> \s ->
|
||||||
puzzleTest
|
testGroup s $
|
||||||
[ puzzle1
|
puzzleTest s
|
||||||
, puzzle2
|
<$> [ puzzle1
|
||||||
]
|
, puzzle2
|
||||||
|
]
|
||||||
|
|
||||||
puzzleTest :: Puzzle -> TestTree
|
puzzleTest :: FilePath -> Puzzle -> TestTree
|
||||||
puzzleTest Puzzle{number, parser, parts} =
|
puzzleTest t Puzzle{number, parser, parts} =
|
||||||
testGroup pt $
|
|
||||||
["examples", "real"] <&> \t ->
|
|
||||||
withResource (parseFile $ "inputs/" <> t <> "/" <> pt) mempty \input ->
|
withResource (parseFile $ "inputs/" <> t <> "/" <> pt) mempty \input ->
|
||||||
testGroup t $
|
testGroup pt $
|
||||||
zip (map show [1 :: Int ..]) parts <&> \(n, pp) ->
|
zip (map show [1 :: Int ..]) parts <&> \(n, pp) ->
|
||||||
goldenVsString n ("outputs/" <> t <> "/" <> pt <> "/" <> n) $
|
goldenVsString n ("outputs/" <> t <> "/" <> pt <> "/" <> n) $
|
||||||
BL.fromStrict . encodeUtf8 . pp <$> input
|
BL.fromStrict . encodeUtf8 . pp <$> input
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user