Show diff for golden test failures
This commit is contained in:
parent
2862457529
commit
6e851d63f0
@ -43,7 +43,7 @@ main =
|
|||||||
withResource (parseFile $ "../inputs/" <> t <> "/" <> pt) mempty \input ->
|
withResource (parseFile $ "../inputs/" <> t <> "/" <> pt) mempty \input ->
|
||||||
testGroup pt $
|
testGroup pt $
|
||||||
( zip (map show [1 :: Int ..]) parts <&> \(n, pp) ->
|
( zip (map show [1 :: Int ..]) parts <&> \(n, pp) ->
|
||||||
goldenVsString n ("../outputs/" <> t <> "/" <> pt <> "/" <> n) $
|
goldenVsStringDiff n diffCommand ("../outputs/" <> t <> "/" <> pt <> "/" <> n) $
|
||||||
TL.encodeUtf8 . pp <$> input
|
TL.encodeUtf8 . pp <$> input
|
||||||
)
|
)
|
||||||
<> [testGroup "extra" $ extraTests isRealData ("../outputs/" <> t <> "/" <> pt <> "/extra/") input]
|
<> [testGroup "extra" $ extraTests isRealData ("../outputs/" <> t <> "/" <> pt <> "/extra/") input]
|
||||||
|
|||||||
@ -41,6 +41,7 @@ module Pre (
|
|||||||
allUnorderedPairs,
|
allUnorderedPairs,
|
||||||
adjacentPairs,
|
adjacentPairs,
|
||||||
sortPair,
|
sortPair,
|
||||||
|
diffCommand,
|
||||||
)
|
)
|
||||||
where
|
where
|
||||||
|
|
||||||
@ -122,3 +123,6 @@ adjacentPairs = \case
|
|||||||
|
|
||||||
sortPair :: (Ord a) => (a, a) -> (a, a)
|
sortPair :: (Ord a) => (a, a) -> (a, a)
|
||||||
sortPair (a, b) = if a <= b then (a, b) else (b, a)
|
sortPair (a, b) = if a <= b then (a, b) else (b, a)
|
||||||
|
|
||||||
|
diffCommand :: FilePath -> FilePath -> [String]
|
||||||
|
diffCommand a b = ["diff", "--color=always", a, b]
|
||||||
|
|||||||
@ -31,7 +31,7 @@ puzzle =
|
|||||||
let frames = Seq.fromList . takeUntil noneAccessible . fmap snd . generateFrames . mkGrid <$> input
|
let frames = Seq.fromList . takeUntil noneAccessible . fmap snd . generateFrames . mkGrid <$> input
|
||||||
nFrames = if isRealData then 58 else 9
|
nFrames = if isRealData then 58 else 9
|
||||||
in ( [0 .. nFrames] <&> \n ->
|
in ( [0 .. nFrames] <&> \n ->
|
||||||
goldenVsString (show n) (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
|
||||||
)
|
)
|
||||||
<> [ testCase "end" do
|
<> [ testCase "end" do
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user