Skip to content

Commit 270fae3

Browse files
committed
Add result to counterexample
1 parent 3641d35 commit 270fae3

File tree

1 file changed

+14
-3
lines changed
  • libs/cardano-ledger-conformance/test/Test/Cardano/Ledger/Conformance/Spec/Conway

1 file changed

+14
-3
lines changed

libs/cardano-ledger-conformance/test/Test/Cardano/Ledger/Conformance/Spec/Conway/Ratify.hs

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
{-# LANGUAGE DataKinds #-}
33
{-# LANGUAGE FlexibleContexts #-}
44
{-# LANGUAGE ImportQualifiedPost #-}
5+
{-# LANGUAGE OverloadedStrings #-}
56
{-# LANGUAGE RankNTypes #-}
67
{-# LANGUAGE RecordWildCards #-}
78
{-# LANGUAGE ScopedTypeVariables #-}
@@ -36,6 +37,7 @@ import Test.Cardano.Ledger.Constrained.Conway.MiniTrace (
3637
ConstrainedGeneratorBundle (..),
3738
constrainedRatify,
3839
)
40+
import Test.Cardano.Ledger.Conway.TreeDiff (tableDoc)
3941
import Test.Cardano.Ledger.Imp.Common
4042

4143
conformsToImplAccepted ::
@@ -59,13 +61,22 @@ conformsToImplAccepted impl agda = property $ do
5961
conjoin $
6062
zipWith
6163
( \ga sga ->
62-
counterexample (prettify ratifyEnv ratifySt ga) $
63-
impl ratifyEnv ratifySt ga == agda specEnv specSt sga
64+
let implRes = impl ratifyEnv ratifySt ga
65+
agdaRes = agda specEnv specSt sga
66+
in counterexample (prettify ratifyEnv ratifySt ga implRes agdaRes) $
67+
implRes == agdaRes
6468
)
6569
govActions
6670
specGovActions
6771
where
68-
prettify ratifyEnv ratifySt ga = ansiDocToString $ Pretty.vsep $ [ansiExpr ratifyEnv, ansiExpr ratifySt, ansiExpr ga]
72+
prettify ratifyEnv ratifySt ga implRes agdaRes =
73+
ansiDocToString $
74+
Pretty.vsep $
75+
tableDoc Nothing [("Impl:", showAccepted implRes), ("Spec:", showAccepted agdaRes)]
76+
: [ansiExpr ratifyEnv, ansiExpr ratifySt, ansiExpr ga]
77+
78+
showAccepted True = Pretty.brackets ""
79+
showAccepted False = Pretty.brackets "×"
6980

7081
spec :: Spec
7182
spec = describe "RATIFY" $ do

0 commit comments

Comments
 (0)