Add some useful inputs to extraTests

This commit is contained in:
George Thomas 2025-12-04 21:16:46 +00:00
parent 2f35bd9251
commit f91824a6a9
6 changed files with 9 additions and 7 deletions

View File

@ -1,7 +1,9 @@
module Main (main) where
import Data.Bool
import Data.ByteString.Lazy qualified as BL
import Data.Functor
import Data.List.Extra
import Data.Text.Encoding (encodeUtf8)
import Data.Text.IO qualified as T
import Puzzle
@ -19,7 +21,7 @@ main =
defaultMain
. localOption (Always :: UseColor)
. testGroup "tests"
$ ["examples", "real"] <&> \t ->
$ enumerate <&> \isRealData@(bool "examples" "real" -> t) ->
testGroup t $
[ Day1.puzzle
, Day2.puzzle
@ -40,4 +42,4 @@ main =
goldenVsString n ("../outputs/" <> t <> "/" <> pt <> "/" <> n) $
BL.fromStrict . encodeUtf8 . pp <$> input
)
<> [testGroup "extra" extraTests]
<> [testGroup "extra" $ extraTests isRealData ("../outputs/" <> t <> "/" <> pt <> "/extra/") input]

View File

@ -9,5 +9,5 @@ data Puzzle = forall input. Puzzle
{ number :: Word
, parser :: Parsec Void Text input
, parts :: [input -> Text]
, extraTests :: [TestTree]
, extraTests :: Bool -> FilePath -> IO input -> [TestTree]
}

View File

@ -37,7 +37,7 @@ puzzle =
| p' == 0 -> abs c + 1
| otherwise -> abs c
]
, extraTests = []
, extraTests = mempty
}
data Direction = L | R

View File

@ -25,7 +25,7 @@ puzzle =
. concatMap
(mapMaybe (\n -> guard (isRepetitionN n) $> n) . uncurry enumFromTo)
]
, extraTests = []
, extraTests = mempty
}
newtype ID = ID Int

View File

@ -26,7 +26,7 @@ puzzle =
. sum
. map (digitsToInt . fromMaybe (error "battery list too short") . maxBatteries 12)
]
, extraTests = []
, extraTests = mempty
}
newtype Bank = Bank (NonEmpty Battery)

View File

@ -27,7 +27,7 @@ puzzle =
. unfoldr ((\r -> guard (fst r /= 0) $> r) . (removeAccessibleRolls <<<<$>>>>) . findAccessible)
. addCoords
]
, extraTests = []
, extraTests = mempty
}
addCoords :: (Num a, Enum a) => [[c]] -> [[(V2 a, c)]]