Test real inputs

This commit is contained in:
George Thomas 2025-12-02 08:25:43 +00:00
parent 1e1d4ee88c
commit 023276e79c
3 changed files with 12 additions and 5 deletions

View File

@ -21,10 +21,15 @@ main =
puzzleTest :: Puzzle a -> TestTree puzzleTest :: Puzzle a -> TestTree
puzzleTest p = puzzleTest p =
withResource (maybe (fail "parse failure") pure . p.parse =<< readFile ("inputs/examples/" <> show p.number)) mempty \input ->
testGroup (show p.number) $ testGroup (show p.number) $
[ ("examples", "examples")
, ("real/2025", "real")
]
<&> \(inFile, outFile) ->
withResource (maybe (fail "parse failure") pure . p.parse =<< readFile ("inputs/" <> inFile <> "/" <> show p.number)) mempty \input ->
testGroup outFile $
[(1 :: Word, p.part1), (2, p.part2)] <&> \(n, pp) -> [(1 :: Word, p.part1), (2, p.part2)] <&> \(n, pp) ->
goldenVsString (show n) ("outputs/examples/" <> show p.number <> "/" <> show n) $ goldenVsString (show n) ("outputs/" <> outFile <> "/" <> show p.number <> "/" <> show n) $
BL.fromStrict . encodeUtf8 . pp.solve <$> input BL.fromStrict . encodeUtf8 . pp.solve <$> input
data Puzzle input = Puzzle data Puzzle input = Puzzle

1
outputs/real/1/1 Normal file
View File

@ -0,0 +1 @@
1132

1
outputs/real/1/2 Normal file
View File

@ -0,0 +1 @@
6623