Share frame generation to avoid accidental quadratic complexity
Previously each test was computing all frames from scratch.
This commit is contained in:
parent
50e3119aef
commit
2cd2341673
@ -26,11 +26,11 @@ puzzle =
|
|||||||
t <- TL.readFile if isRealData then "../inputs/real/4" else "../inputs/examples/4"
|
t <- TL.readFile if isRealData then "../inputs/real/4" else "../inputs/examples/4"
|
||||||
input' <- input
|
input' <- input
|
||||||
t @=? drawGrid (mkGrid input' <&> \case InEmpty -> OutEmpty; InRoll -> OutRoll)
|
t @=? drawGrid (mkGrid input' <&> \case InEmpty -> OutEmpty; InRoll -> OutRoll)
|
||||||
, testGroup
|
, withResource
|
||||||
"frames"
|
(Seq.fromList . takeUntil noneAccessible . fmap snd . generateFrames . mkGrid <$> input)
|
||||||
let frames = Seq.fromList . takeUntil noneAccessible . fmap snd . generateFrames . mkGrid <$> input
|
mempty
|
||||||
nFrames = if isRealData then 58 else 9
|
\frames -> testGroup "frames" let nFrames = if isRealData then 58 else 9 in
|
||||||
in ( [0 .. nFrames] <&> \n ->
|
( [0 .. nFrames] <&> \n ->
|
||||||
goldenVsStringDiff (show n) diffCommand (path <> "frames/" <> show n) $
|
goldenVsStringDiff (show n) diffCommand (path <> "frames/" <> show n) $
|
||||||
TL.encodeUtf8 . maybe "frame list too short!" drawGrid . Seq.lookup n <$> frames
|
TL.encodeUtf8 . maybe "frame list too short!" drawGrid . Seq.lookup n <$> frames
|
||||||
)
|
)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user