From 0a37fa12fc7b4458246ea74c3c07a0136bcd08dc Mon Sep 17 00:00:00 2001 From: Pablo Lamela Date: Mon, 26 Feb 2024 21:53:37 +0100 Subject: [PATCH] Use discard and increase number of tries --- .../cardano-api-test/Test/Cardano/Api/ProtocolParameters.hs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/cardano-api/test/cardano-api-test/Test/Cardano/Api/ProtocolParameters.hs b/cardano-api/test/cardano-api-test/Test/Cardano/Api/ProtocolParameters.hs index 400f1ca416..dba1cf2c8b 100644 --- a/cardano-api/test/cardano-api-test/Test/Cardano/Api/ProtocolParameters.hs +++ b/cardano-api/test/cardano-api-test/Test/Cardano/Api/ProtocolParameters.hs @@ -5,7 +5,7 @@ module Test.Cardano.Api.ProtocolParameters(tests) where import Cardano.Api.Ledger (PParams(..)) import Cardano.Api.ProtocolParameters (ProtocolParameters (..), convertToLedgerProtocolParameters, LedgerProtocolParameters (..), fromLedgerPParams) -import Hedgehog (Property, property, forAll, (===), Gen, success, footnote) +import Hedgehog (Property, property, forAll, (===), Gen, success, footnote, discard, withDiscards, withTests) import Cardano.Api (CardanoEra (..), inEonForEra, ToJSON, prettyPrintJSON, ProtocolParametersConversionError, FromJSON) import Cardano.Api.Eon.ShelleyBasedEra(ShelleyBasedEra(..), ShelleyLedgerEra) import Test.Gen.Cardano.Api.Typed (genProtocolParameters) @@ -37,9 +37,11 @@ tests = protocolParametersSerializeTheSame :: forall era. ToJSON (PParams (ShelleyLedgerEra era)) => CardanoEra era -> Property protocolParametersSerializeTheSame era = + withTests 10000 $ + withDiscards 10000 $ property $ do protocolParameters <- forAll (genProtocolParameters era :: Gen ProtocolParameters) case convertToEraAndSerialize protocolParameters of - Left _ -> success -- fail (show err) + Left _ -> discard Right (roundTrippedProtocolParams, pParamsBS) -> do footnote $ "Decentralization parameter was: " <> show (protocolParamDecentralization protocolParameters) pParamsBS === prettyPrintJSON roundTrippedProtocolParams