This commit is contained in:
George Thomas 2026-01-06 18:48:59 +00:00
parent ecb7391468
commit ce8cfeca67

View File

@ -37,26 +37,28 @@ tests =
, Day8.puzzle , Day8.puzzle
, Day9.puzzle , Day9.puzzle
, Day10.puzzle , Day10.puzzle
] <&> \Puzzle{number = show -> pt, parser, parts, extraTests} -> testLazy ]
(mkTestName pt) <&> \Puzzle{number = show -> pt, parser, parts, extraTests} ->
( \() -> do testLazy
let fp = "../inputs/" <> t <> "/" <> pt (mkTestName pt)
input <- ( \() -> do
either (fail . ("parse failure: " <>) . errorBundlePretty) pure let fp = "../inputs/" <> t <> "/" <> pt
. runParser (parser isRealData <* eof) fp input <-
=<< T.readFile fp either (fail . ("parse failure: " <>) . errorBundlePretty) pure
let (rs, os) = . runParser (parser isRealData <* eof) fp
(lookupHList fst &&& foldHListF (HCons . snd) HNil) $ =<< T.readFile fp
mapHListF (\((Fanout (f, Op o))) -> (o &&& id) $ f input) parts let (rs, os) =
in pure (input, rs, os) (lookupHList fst &&& foldHListF (HCons . snd) HNil) $
) mapHListF (\((Fanout (f, Op o))) -> (o &&& id) $ f input) parts
$ ( finites <&> \(n@(show . succ @Int . fromIntegral -> nt)) -> in pure (input, rs, os)
test )
(mkTestName nt) $ ( finites <&> \(n@(show . succ @Int . fromIntegral -> nt)) ->
(\(_, rs, _) -> golden ("../outputs/" <> t <> "/" <> pt <> "/" <> nt) $ rs n <> "\n") test
[] (mkTestName nt)
) (\(_, rs, _) -> golden ("../outputs/" <> t <> "/" <> pt <> "/" <> nt) $ rs n <> "\n")
<> let ts = extraTests isRealData ("../outputs/" <> t <> "/" <> pt <> "/extra/") []
in if null ts )
then [] <> let ts = extraTests isRealData ("../outputs/" <> t <> "/" <> pt <> "/extra/")
else [testLazy "extra" (\(input, _, os) -> pure (input, os)) ts] in if null ts
then []
else [testLazy "extra" (\(input, _, os) -> pure (input, os)) ts]