@@ -10,7 +10,7 @@ import Cardano.Api
10
10
11
11
import Data.Proxy (Proxy (.. ))
12
12
import Data.String (IsString (.. ))
13
- import Hedgehog (Property , forAll , property , success , tripping )
13
+ import Hedgehog (Property , forAll , tripping )
14
14
import qualified Hedgehog as H
15
15
import qualified Hedgehog.Gen as Gen
16
16
import Test.Cardano.Api.Typed.Orphans ()
@@ -156,38 +156,18 @@ prop_roundtrip_UpdateProposal_CBOR :: Property
156
156
prop_roundtrip_UpdateProposal_CBOR =
157
157
roundtrip_CBOR AsUpdateProposal genUpdateProposal
158
158
159
+ prop_roundtrip_Tx_Cddl :: Property
160
+ prop_roundtrip_Tx_Cddl = H. property $ do
161
+ AnyCardanoEra era <- H. forAll $ Gen. element [minBound .. maxBound ]
162
+ x <- forAll $ genTx era
163
+ H. tripping x serialiseTxLedgerCddl (deserialiseTxLedgerCddl era)
159
164
160
- test_roundtrip_Tx_Cddl :: [TestTree ]
161
- test_roundtrip_Tx_Cddl =
162
- [ testPropertyNamed (show era) (fromString (show era)) $ roundtrip_Tx_Cddl anyEra
163
- | anyEra@ (AnyCardanoEra era) <- [minBound .. (AnyCardanoEra AlonzoEra )] -- TODO: Babbage era
164
- ]
165
-
166
- test_roundtrip_TxWitness_Cddl :: [TestTree ]
167
- test_roundtrip_TxWitness_Cddl =
168
- [ testPropertyNamed (show era) (fromString (show era)) $ roundtrip_TxWitness_Cddl era
169
- | AnyCardanoEra era <- [minBound .. (AnyCardanoEra AlonzoEra )] -- TODO: Babbage era
170
- , AnyCardanoEra era /= AnyCardanoEra ByronEra
171
- ]
165
+ prop_roundtrip_TxWitness_Cddl :: Property
166
+ prop_roundtrip_TxWitness_Cddl = H. property $ do
167
+ AnyShelleyBasedEra sbe <- H. forAll $ Gen. element [minBound .. maxBound ]
168
+ x <- forAll $ genShelleyKeyWitness $ shelleyBasedToCardanoEra sbe
169
+ tripping x (serialiseWitnessLedgerCddl sbe) (deserialiseWitnessLedgerCddl sbe)
172
170
173
- roundtrip_TxWitness_Cddl :: CardanoEra era -> Property
174
- roundtrip_TxWitness_Cddl era =
175
- property $
176
- case cardanoEraStyle era of
177
- LegacyByronEra -> success
178
- ShelleyBasedEra sbe -> do
179
- keyWit <- forAll $ genShelleyKeyWitness era
180
- tripping keyWit
181
- (serialiseWitnessLedgerCddl sbe)
182
- (deserialiseWitnessLedgerCddl sbe)
183
-
184
- roundtrip_Tx_Cddl :: AnyCardanoEra -> Property
185
- roundtrip_Tx_Cddl (AnyCardanoEra era) =
186
- property $ do
187
- tx <- forAll $ genTx era
188
- tripping tx
189
- serialiseTxLedgerCddl
190
- (deserialiseTxLedgerCddl era)
191
171
192
172
-- -----------------------------------------------------------------------------
193
173
@@ -223,7 +203,7 @@ tests = testGroup "Test.Cardano.Api.Typed.CBOR"
223
203
, testPropertyNamed " roundtrip UpdateProposal CBOR" " roundtrip UpdateProposal CBOR" prop_roundtrip_UpdateProposal_CBOR
224
204
, testPropertyNamed " roundtrip ScriptData CBOR" " roundtrip ScriptData CBOR" prop_roundtrip_ScriptData_CBOR
225
205
, testPropertyNamed " roundtrip txbody CBOR" " roundtrip txbody CBOR" prop_roundtrip_txbody_CBOR
206
+ , testPropertyNamed " roundtrip Tx Cddl" " roundtrip Tx Cddl" prop_roundtrip_Tx_Cddl
207
+ , testPropertyNamed " roundtrip TxWitness Cddl" " roundtrip TxWitness Cddl" prop_roundtrip_TxWitness_Cddl
226
208
, testGroup " roundtrip tx CBOR" test_roundtrip_tx_CBOR
227
- , testGroup " roundtrip Tx Cddl" test_roundtrip_Tx_Cddl
228
- , testGroup " roundtrip TxWitness Cddl" test_roundtrip_TxWitness_Cddl
229
209
]
0 commit comments