diff --git a/cabal.project b/cabal.project index b4dfaf52d1b..8a02a2ccbc2 100644 --- a/cabal.project +++ b/cabal.project @@ -27,8 +27,8 @@ source-repository-package -- NOTE: If you would like to update the above, -- see CONTRIBUTING.md#to-update-the-referenced-agda-ledger-spec index-state: - , hackage.haskell.org 2026-05-06T14:09:41Z - , cardano-haskell-packages 2026-04-11T06:29:42Z + , hackage.haskell.org 2026-05-26T01:52:59Z + , cardano-haskell-packages 2026-05-25T13:25:40Z packages: -- == Byron era == @@ -124,61 +124,21 @@ if impl(ghc >=9.14) , containers >= 0.8 , foldl >= 1.4.18 +-- cabal-allow-newer begin +if impl(ghc >=9.14) allow-newer: - -- https://github.com/IntersectMBO/cardano-ledger/issues/5588 - -- Plutus stuff has been fixed in the master branch on Github, - -- but not yet released to CHaP. - , aeson:QuickCheck - , aeson:base - , aeson:containers - , aeson:data-fix - , aeson:template-haskell - , aeson:time - , binary-orphans:base - , boring:base , canonical-json:containers , cborg:base , cborg:containers - , serialise:base - , serialise:containers - , config-ini:containers - , constraints-extras:base - , constraints-extras:template-haskell - , dependent-map:constraints-extras + , constrained-generators:QuickCheck , dependent-map:containers , dictionary-sharing:containers - , dec:base - , bin:base - , fin:base - , ral:base - , http-api-data:base - , http-api-data:containers - , indexed-traversable:base - , indexed-traversable:containers - , indexed-traversable-instances:base - , microstache:base - , microstache:containers - , nonempty-vector:base + , hedgehog-quickcheck:QuickCheck , ordered-containers:containers + , partial-order:containers , persistent:template-haskell - , plutus-core:dependent-map - , plutus-core:vty - , plutus-core:vty-crossplatform - , pqueue:base - , quickcheck-instances:base - , quickcheck-instances:containers - , quickcheck-instances:these - , quickcheck-instances:uuid-types , safe-wild-cards:template-haskell - , semialign:base - , semialign:containers - , semialign:indexed-traversable - , semialign:indexed-traversable-instances - , these:base - , tree-diff:QuickCheck - , tree-diff:base - , tree-diff:containers - , tree-diff:time - , universe-base:base - , universe-base:containers - , uuid-types:template-haskell + , serialise:base + , serialise:containers + , serialise:time +-- cabal-allow-newer end diff --git a/eras/mary/impl/cardano-ledger-mary.cabal b/eras/mary/impl/cardano-ledger-mary.cabal index e4dd8ab3457..6afc2c8d1d5 100644 --- a/eras/mary/impl/cardano-ledger-mary.cabal +++ b/eras/mary/impl/cardano-ledger-mary.cabal @@ -175,7 +175,7 @@ library testlib build-depends: base, bytestring, - cardano-base:testlib, + cardano-base:testlib >=0.1.4, cardano-crypto-class, cardano-data:testlib, cardano-ledger-allegra:{cardano-ledger-allegra, testlib}, @@ -213,6 +213,7 @@ test-suite tests base, base16-bytestring, bytestring, + cardano-base:testlib >=0.1.5.0, cardano-data:{cardano-data, testlib}, cardano-ledger-allegra:testlib, cardano-ledger-binary:{cardano-ledger-binary, testlib}, diff --git a/eras/mary/impl/test/Test/Cardano/Ledger/Mary/ValueSpec.hs b/eras/mary/impl/test/Test/Cardano/Ledger/Mary/ValueSpec.hs index f72b3d9a6ee..794e4506a90 100644 --- a/eras/mary/impl/test/Test/Cardano/Ledger/Mary/ValueSpec.hs +++ b/eras/mary/impl/test/Test/Cardano/Ledger/Mary/ValueSpec.hs @@ -23,6 +23,7 @@ import Data.CanonicalMaps (canonicalInsert) import qualified Data.Map.Strict as Map import Data.Maybe (fromJust) import GHC.Exts +import qualified Test.Cardano.Base.QuickCheck as BaseQC import Test.Cardano.Data import Test.Cardano.Ledger.Binary.RoundTrip ( roundTripCborExpectation, @@ -45,7 +46,7 @@ spec :: Spec spec = do describe "MultiAsset" $ do prop "Canonical construction agrees" $ - withMaxSuccess 10000 propCanonicalConstructionAgrees + BaseQC.withNumTests 10000 propCanonicalConstructionAgrees describe "CBOR roundtrip" $ do describe "Coin" $ do prop "Non-negative Coin succeeds for all eras" $ diff --git a/eras/shelley-ma/test-suite/cardano-ledger-shelley-ma-test.cabal b/eras/shelley-ma/test-suite/cardano-ledger-shelley-ma-test.cabal index 304c84bc2f2..58cc16c8bd0 100644 --- a/eras/shelley-ma/test-suite/cardano-ledger-shelley-ma-test.cabal +++ b/eras/shelley-ma/test-suite/cardano-ledger-shelley-ma-test.cabal @@ -100,6 +100,7 @@ test-suite cardano-ledger-shelley-ma-test QuickCheck, base, bytestring, + cardano-base:testlib >=0.1.5.0, cardano-crypto-class, cardano-data, cardano-ledger-allegra, diff --git a/eras/shelley-ma/test-suite/test/Test/Cardano/Ledger/Mary/Value.hs b/eras/shelley-ma/test-suite/test/Test/Cardano/Ledger/Mary/Value.hs index 3c4d6b82f9a..afc97ce9a50 100644 --- a/eras/shelley-ma/test-suite/test/Test/Cardano/Ledger/Mary/Value.hs +++ b/eras/shelley-ma/test-suite/test/Test/Cardano/Ledger/Mary/Value.hs @@ -34,6 +34,7 @@ import qualified Data.Group as G import Data.Map.Strict (empty, singleton) import qualified Data.Map.Strict as Map import Data.Maybe (fromMaybe) +import qualified Test.Cardano.Base.QuickCheck as BaseQC import Test.Cardano.Ledger.Mary.Arbitrary () import Test.Cardano.Ledger.Shelley.Serialisation.EraIndepGenerators () import Test.Cardano.Ledger.Shelley.Serialisation.Generators () @@ -390,7 +391,7 @@ exampleMultiAssets = [s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12] -- This was used to diagnose https://github.com/input-output-hk/cardano-node/issues/4826 subtractionIsTotal :: TestTree subtractionIsTotal = testProperty "multi-asset subtraction is total" $ - QC.withMaxSuccess 100000 $ + BaseQC.withNumTests 100000 $ do shuffle1 <- take 12 <$> QC.shuffle exampleMultiAssets shuffle2 <- take 2 <$> QC.shuffle exampleMultiAssets diff --git a/eras/shelley/test-suite/cardano-ledger-shelley-test.cabal b/eras/shelley/test-suite/cardano-ledger-shelley-test.cabal index 4ddca9abd3c..03f0600eb73 100644 --- a/eras/shelley/test-suite/cardano-ledger-shelley-test.cabal +++ b/eras/shelley/test-suite/cardano-ledger-shelley-test.cabal @@ -80,7 +80,7 @@ library QuickCheck >=2.13.2, base >=4.18 && <5, bytestring, - cardano-base:testlib, + cardano-base:testlib >=0.1.5.0, cardano-crypto, cardano-crypto-class, cardano-crypto-wrapper, diff --git a/eras/shelley/test-suite/src/Test/Cardano/Ledger/Shelley/Rewards.hs b/eras/shelley/test-suite/src/Test/Cardano/Ledger/Shelley/Rewards.hs index e12f1c8d08d..73a9dc276f6 100644 --- a/eras/shelley/test-suite/src/Test/Cardano/Ledger/Shelley/Rewards.hs +++ b/eras/shelley/test-suite/src/Test/Cardano/Ledger/Shelley/Rewards.hs @@ -120,6 +120,7 @@ import qualified Data.VMap as VMap import Data.Word (Word64) import Lens.Micro ((&), (.~), (^.)) import Numeric.Natural (Natural) +import qualified Test.Cardano.Base.QuickCheck as BaseQC import Test.Cardano.Ledger.Core.KeyPair (KeyPair (..), vKey) import Test.Cardano.Ledger.Core.Utils (mkActiveStake) import Test.Cardano.Ledger.Shelley.ConcreteCryptoTypes (MockCrypto) @@ -149,7 +150,6 @@ import Test.Tasty.QuickCheck ( noShrinking, property, testProperty, - withMaxSuccess, ) -- ======================================================================== @@ -671,7 +671,7 @@ lastElem (_ : xs) = lastElem xs -- | Provide a legitimate NewEpochState to make an test Property newEpochProp :: Word64 -> (NewEpochState ShelleyEra -> Property) -> Property -newEpochProp tracelen propf = withMaxSuccess 100 $ +newEpochProp tracelen propf = BaseQC.withNumTests 100 $ forAllChainTrace @ShelleyEra tracelen defaultConstants $ \tr -> case lastElem (sourceSignalTargets tr) of Just SourceSignalTarget {target} -> propf (chainNes target) @@ -680,7 +680,7 @@ newEpochProp tracelen propf = withMaxSuccess 100 $ -- | Given a NewEpochState and [ChainEvent], test a Property at every Epoch Boundary newEpochEventsProp :: Word64 -> ([ChainEvent ShelleyEra] -> NewEpochState ShelleyEra -> Property) -> Property -newEpochEventsProp tracelen propf = withMaxSuccess 10 $ +newEpochEventsProp tracelen propf = BaseQC.withNumTests 10 $ forEachEpochTrace @ShelleyEra 10 tracelen defaultConstants $ \tr -> case lastElem (sourceSignalTargets tr) of Just SourceSignalTarget {target} -> @@ -724,7 +724,7 @@ eventsMirrorRewards events nes = same eventRew compRew total = getMostRecentTotalRewardEvent events aggevent = aggIncrementalRewardEvents events FilteredRewards aggFilteredEvent _ _ _ = filterAllRewards aggevent (nesEs nes) - same x y = withMaxSuccess 1 $ counterexample message (x === y) + same x y = BaseQC.withNumTests 1 $ counterexample message (x === y) where message = "events don't mirror rewards " @@ -810,7 +810,7 @@ tests = testGroup "Reward Tests" [ testProperty "Sum of rewards is bounded by reward pot" $ - withMaxSuccess numberOfTests (rewardsBoundedByPot (Proxy @ShelleyEra)) + BaseQC.withNumTests numberOfTests (rewardsBoundedByPot (Proxy @ShelleyEra)) , testProperty "compare with reference impl, no provenance, v3" . noShrinking $ newEpochProp chainlen (oldEqualsNew @ShelleyEra (ProtVer (natVersion @3) 0)) , testProperty "compare with reference impl, no provenance, v7" . noShrinking $ diff --git a/eras/shelley/test-suite/src/Test/Cardano/Ledger/Shelley/Rules/AdaPreservation.hs b/eras/shelley/test-suite/src/Test/Cardano/Ledger/Shelley/Rules/AdaPreservation.hs index 6ac3d2aa49b..f67429b9cb2 100644 --- a/eras/shelley/test-suite/src/Test/Cardano/Ledger/Shelley/Rules/AdaPreservation.hs +++ b/eras/shelley/test-suite/src/Test/Cardano/Ledger/Shelley/Rules/AdaPreservation.hs @@ -56,6 +56,7 @@ import qualified Data.Map.Strict as Map import Data.TreeDiff.QuickCheck (ediffEq) import Lens.Micro hiding (ix) import Lens.Micro.Extras (view) +import qualified Test.Cardano.Base.QuickCheck as BaseQC import Test.Cardano.Ledger.Shelley.ConcreteCryptoTypes (MockCrypto) import Test.Cardano.Ledger.Shelley.Constants (defaultConstants) import Test.Cardano.Ledger.Shelley.Generator.Core (GenEnv) @@ -88,7 +89,6 @@ import Test.QuickCheck ( (.||.), (===), ) -import Test.QuickCheck.Property (withMaxSuccess) import Test.Tasty (TestTree) import qualified Test.Tasty.QuickCheck as TQC @@ -111,7 +111,7 @@ tests :: tests n = TQC.testProperty "total amount of Ada is preserved (Chain)" - (noShrinking $ withMaxSuccess n (adaPreservationProps @era)) + (noShrinking $ BaseQC.withNumTests n (adaPreservationProps @era)) -- | Various preservation properties adaPreservationProps :: diff --git a/eras/shelley/test-suite/src/Test/Cardano/Ledger/Shelley/Rules/ClassifyTraces.hs b/eras/shelley/test-suite/src/Test/Cardano/Ledger/Shelley/Rules/ClassifyTraces.hs index e8a72f09754..382676aed5d 100644 --- a/eras/shelley/test-suite/src/Test/Cardano/Ledger/Shelley/Rules/ClassifyTraces.hs +++ b/eras/shelley/test-suite/src/Test/Cardano/Ledger/Shelley/Rules/ClassifyTraces.hs @@ -59,6 +59,7 @@ import Data.Semigroup (Sum (..)) import Data.Sequence.Strict (StrictSeq) import Lens.Micro import Lens.Micro.Extras (view) +import qualified Test.Cardano.Base.QuickCheck as BaseQC import Test.Cardano.Ledger.Shelley.ConcreteCryptoTypes (MockCrypto) import Test.Cardano.Ledger.Shelley.Constants (defaultConstants) import Test.Cardano.Ledger.Shelley.Generator.Core (GenEnv) @@ -89,7 +90,6 @@ import Test.QuickCheck ( forAllBlind, property, stdConfidence, - withMaxSuccess, ) import Test.Tasty (TestTree) import qualified Test.Tasty.QuickCheck as TQC @@ -108,7 +108,7 @@ relevantCasesAreCovered :: relevantCasesAreCovered n = TQC.testProperty "Chain and Ledger traces cover the relevant cases" - (TQC.withMaxSuccess n prop) + (BaseQC.withNumTests n prop) where prop = do let tl = 100 @@ -314,7 +314,7 @@ onlyValidLedgerSignalsAreGenerated = TQC.testProperty "Only valid Ledger STS signals are generated" prop where prop = - withMaxSuccess 200 $ + BaseQC.withNumTests 200 $ onlyValidSignalsAreGeneratedFromInitState @ledger testGlobals @@ -401,7 +401,7 @@ onlyValidChainSignalsAreGenerated = TQC.testProperty "Only valid CHAIN STS signals are generated" prop where prop = - withMaxSuccess 100 $ + BaseQC.withNumTests 100 $ onlyValidSignalsAreGeneratedFromInitState @(CHAIN era) testGlobals 100 diff --git a/eras/shelley/test-suite/src/Test/Cardano/Ledger/Shelley/Rules/TestChain.hs b/eras/shelley/test-suite/src/Test/Cardano/Ledger/Shelley/Rules/TestChain.hs index 097c97d726e..14fdd721aa4 100644 --- a/eras/shelley/test-suite/src/Test/Cardano/Ledger/Shelley/Rules/TestChain.hs +++ b/eras/shelley/test-suite/src/Test/Cardano/Ledger/Shelley/Rules/TestChain.hs @@ -68,6 +68,7 @@ import qualified Data.Set as Set import Data.Word (Word64) import Lens.Micro ((^.)) import Lens.Micro.Extras (view) +import qualified Test.Cardano.Base.QuickCheck as BaseQC import Test.Cardano.Ledger.BlockHeader (TestBlockHeader) import Test.Cardano.Ledger.Shelley.ConcreteCryptoTypes (MockCrypto) import Test.Cardano.Ledger.Shelley.Constants (Constants) @@ -97,7 +98,6 @@ import Test.QuickCheck ( Property, Testable (..), conjoin, - withMaxSuccess, ) ------------------------------ @@ -135,7 +135,7 @@ shortChainTrace :: Constants -> (SourceSignalTarget (CHAIN era) -> Property) -> Property -shortChainTrace constants f = withMaxSuccess 100 $ forAllChainTrace @era 10 constants $ \tr -> conjoin (map f (sourceSignalTargets tr)) +shortChainTrace constants f = BaseQC.withNumTests 100 $ forAllChainTrace @era 10 constants $ \tr -> conjoin (map f (sourceSignalTargets tr)) ---------------------------------------------------------------------- -- Projections of CHAIN Trace @@ -337,7 +337,7 @@ forAllChainTrace :: (Trace (CHAIN era) -> prop) -> Property forAllChainTrace n constants prop = - withMaxSuccess (fromIntegral numberOfTests) . property $ + BaseQC.withNumTests (fromIntegral numberOfTests) . property $ forAllTraceFromInitState testGlobals n diff --git a/flake.lock b/flake.lock index 2741b7d461f..889cafd9b0f 100644 --- a/flake.lock +++ b/flake.lock @@ -3,11 +3,11 @@ "CHaP": { "flake": false, "locked": { - "lastModified": 1775892872, - "narHash": "sha256-8qwpclExAZYF5e35xqt9yQYcal3FJLirKNIMiomAIvs=", + "lastModified": 1779721159, + "narHash": "sha256-mewNJj5lMwoNJLtkg69+AW76AiUBpbuJtdC/tdgbPmk=", "owner": "intersectmbo", "repo": "cardano-haskell-packages", - "rev": "86660ad10909f521a9c42cb01e9626aefd3903cf", + "rev": "61d073fbab6dd2ab96378d84b382f2738ab143f2", "type": "github" }, "original": { @@ -292,11 +292,11 @@ "hackageNix": { "flake": false, "locked": { - "lastModified": 1778128665, - "narHash": "sha256-A8X56xHMs9hWFr8tG91n4WhjCn/1BiD9oGd7otQgk1E=", + "lastModified": 1779760624, + "narHash": "sha256-ipjJFL6OHxx8MkwLdex8IpqWwLu+dV1OeiFTBNnepRk=", "owner": "input-output-hk", "repo": "hackage.nix", - "rev": "692da95600702017553fb12d4594303e16937a31", + "rev": "e24e422661ba36384bf8ca0733542ca0b8966839", "type": "github" }, "original": { diff --git a/libs/cardano-ledger-core/cardano-ledger-core.cabal b/libs/cardano-ledger-core/cardano-ledger-core.cabal index d267d8ff832..2444c95c2c2 100644 --- a/libs/cardano-ledger-core/cardano-ledger-core.cabal +++ b/libs/cardano-ledger-core/cardano-ledger-core.cabal @@ -201,7 +201,7 @@ library cddl cardano-ledger-binary, cardano-ledger-core, cborg, - cuddle >=1.7, + cuddle >=1.7 && <1.8, heredoc, mempack, quickcheck-transformer, diff --git a/libs/cardano-ledger-test/src/Test/Cardano/Ledger/Constrained/Conway/LedgerTypes/Tests.hs b/libs/cardano-ledger-test/src/Test/Cardano/Ledger/Constrained/Conway/LedgerTypes/Tests.hs index 711673f603b..e1d6ab2745f 100644 --- a/libs/cardano-ledger-test/src/Test/Cardano/Ledger/Constrained/Conway/LedgerTypes/Tests.hs +++ b/libs/cardano-ledger-test/src/Test/Cardano/Ledger/Constrained/Conway/LedgerTypes/Tests.hs @@ -26,6 +26,7 @@ import Data.Kind (Type) import Data.Map (Map) import Data.TreeDiff import Data.Typeable +import qualified Test.Cardano.Base.QuickCheck as BaseQC import Test.Cardano.Ledger.Constrained.Conway.Cert ( testConwayCert, testShelleyCert, @@ -43,7 +44,6 @@ import Test.QuickCheck ( Property, counterexample, property, - withMaxSuccess, ) -- ==================================================================================== @@ -114,7 +114,7 @@ soundSpecWith :: forall t. (HasSpec t, ToExpr t) => Int -> Gen (Specification t) -> SpecWith (Arg Property) -soundSpecWith n specx = it (show (typeRep (Proxy @t))) $ withMaxSuccess n $ property $ (soundSpec @t specx) +soundSpecWith n specx = it (show (typeRep (Proxy @t))) $ BaseQC.withNumTests n $ property $ (soundSpec @t specx) -- | A bunch of soundness tests on different LederTypes, all in the same Era. -- The idea is to run this suite on every era. diff --git a/libs/cardano-ledger-test/src/Test/Cardano/Ledger/Constrained/Conway/MiniTrace.hs b/libs/cardano-ledger-test/src/Test/Cardano/Ledger/Constrained/Conway/MiniTrace.hs index 1826e795aba..65a517ade68 100644 --- a/libs/cardano-ledger-test/src/Test/Cardano/Ledger/Constrained/Conway/MiniTrace.hs +++ b/libs/cardano-ledger-test/src/Test/Cardano/Ledger/Constrained/Conway/MiniTrace.hs @@ -80,6 +80,7 @@ import qualified Data.Set as Set import GHC.Generics (Generic) import GHC.TypeLits (KnownSymbol, Symbol, symbolVal) import Lens.Micro ((^.)) +import qualified Test.Cardano.Base.QuickCheck as BaseQC import Test.Cardano.Ledger.Common hiding (forAll) import Test.Cardano.Ledger.Constrained.Conway ( EraSpecCert (..), @@ -221,7 +222,7 @@ runMinitrace :: runMinitrace cgb classifier = prop (symbolVal $ Proxy @rule) - (withMaxSuccess 50 (minitraceProp @rule @era 50 cgb classifier)) + (BaseQC.withNumTests 50 (minitraceProp @rule @era 50 cgb classifier)) genDelegCtx :: Gen (WitUniv ConwayEra, ConwayCertGenContext ConwayEra) genDelegCtx = do diff --git a/libs/cardano-ledger-test/src/Test/Cardano/Ledger/Generic/Trace.hs b/libs/cardano-ledger-test/src/Test/Cardano/Ledger/Generic/Trace.hs index b875bbc35f5..ed2b75e21ec 100644 --- a/libs/cardano-ledger-test/src/Test/Cardano/Ledger/Generic/Trace.hs +++ b/libs/cardano-ledger-test/src/Test/Cardano/Ledger/Generic/Trace.hs @@ -59,6 +59,7 @@ import qualified Data.Vector as Vector import qualified Debug.Trace as Debug import GHC.Word (Word64) import Lens.Micro ((&), (.~), (^.)) +import qualified Test.Cardano.Base.QuickCheck as BaseQC import Test.Cardano.Ledger.Alonzo.Era import Test.Cardano.Ledger.Common import Test.Cardano.Ledger.Examples.STSTestUtils (EraModel (..)) @@ -454,7 +455,7 @@ forAllTraceFromInitState baseEnv maxTraceLength traceGenEnv genSt0 = -- like not getting turned off because the tests take too long. A glaring failure is -- likely to be caught in 'n' tests, rather than the standard '100' testPropMax :: (HasCallStack, Testable prop) => Int -> String -> prop -> Spec -testPropMax n name x = prop name (withMaxSuccess n x) +testPropMax n name x = prop name (BaseQC.withNumTests n x) chainTest :: forall era. diff --git a/libs/cardano-ledger-test/src/Test/Cardano/Ledger/Generic/TxGen.hs b/libs/cardano-ledger-test/src/Test/Cardano/Ledger/Generic/TxGen.hs index 580d247cf85..130523007cb 100644 --- a/libs/cardano-ledger-test/src/Test/Cardano/Ledger/Generic/TxGen.hs +++ b/libs/cardano-ledger-test/src/Test/Cardano/Ledger/Generic/TxGen.hs @@ -138,7 +138,7 @@ import Test.Cardano.Ledger.Generic.ModelState ( import Test.Cardano.Ledger.Generic.Proof hiding (lift) import Test.Cardano.Ledger.Shelley.Serialisation.EraIndepGenerators () import Test.Cardano.Ledger.Shelley.Utils (epochFromSlotNo, runShelleyBase) -import Test.QuickCheck +import Test.QuickCheck (Arbitrary (..), Gen, choose, chooseInt, elements, resize, shuffle, vectorOf) alonzoMkRedeemersFromTags :: (AlonzoEraScript era, EraModel era) => diff --git a/libs/cardano-ledger-test/src/Test/Cardano/Ledger/Tickf.hs b/libs/cardano-ledger-test/src/Test/Cardano/Ledger/Tickf.hs index 83cd0818ec0..c172e809a2b 100644 --- a/libs/cardano-ledger-test/src/Test/Cardano/Ledger/Tickf.hs +++ b/libs/cardano-ledger-test/src/Test/Cardano/Ledger/Tickf.hs @@ -25,6 +25,7 @@ import Cardano.Ledger.State ( import qualified Data.Map.Strict as Map import Data.Ratio ((%)) import qualified Data.VMap as VMap +import qualified Test.Cardano.Base.QuickCheck as BaseQC import Test.Cardano.Ledger.Common import Test.Cardano.Ledger.Shelley.Arbitrary () import Test.Cardano.Ledger.Shelley.Serialisation.EraIndepGenerators () @@ -35,7 +36,7 @@ calcPoolDistOldEqualsNew :: Spec calcPoolDistOldEqualsNew = describe "calculatePoolDistr" $ do prop "old==new" $ - withMaxSuccess 500 $ \snap -> + BaseQC.withNumTests 500 $ \snap -> counterexample "BAD" $ oldCalculatePoolDistr (const True) snap === Shelley.calculatePoolDistr snap diff --git a/libs/cardano-protocol-tpraos/cardano-protocol-tpraos.cabal b/libs/cardano-protocol-tpraos/cardano-protocol-tpraos.cabal index 601402310eb..e717f362b01 100644 --- a/libs/cardano-protocol-tpraos/cardano-protocol-tpraos.cabal +++ b/libs/cardano-protocol-tpraos/cardano-protocol-tpraos.cabal @@ -97,7 +97,7 @@ library testlib build-depends: base, bytestring, - cardano-base:{cardano-base, testlib}, + cardano-base:{cardano-base, testlib} >=0.1.5.0, cardano-crypto-class:{cardano-crypto-class, testlib}, cardano-ledger-allegra:{cardano-ledger-allegra, testlib}, cardano-ledger-alonzo:{cardano-ledger-alonzo, testlib}, @@ -136,6 +136,7 @@ test-suite tests build-depends: base, + cardano-base:testlib >=0.1.5.0, cardano-ledger-allegra:{cardano-ledger-allegra, cddl, testlib}, cardano-ledger-alonzo:{cardano-ledger-alonzo, cddl, testlib}, cardano-ledger-binary:{cardano-ledger-binary, testlib}, diff --git a/libs/cardano-protocol-tpraos/test/Test/Cardano/Protocol/Binary/BinarySpec.hs b/libs/cardano-protocol-tpraos/test/Test/Cardano/Protocol/Binary/BinarySpec.hs index 30c6f53e9c6..0bf35c4427c 100644 --- a/libs/cardano-protocol-tpraos/test/Test/Cardano/Protocol/Binary/BinarySpec.hs +++ b/libs/cardano-protocol-tpraos/test/Test/Cardano/Protocol/Binary/BinarySpec.hs @@ -17,6 +17,7 @@ import Cardano.Protocol.Crypto import Cardano.Protocol.TPraos.BHeader (BHeader) import Data.Proxy import Data.Typeable (typeRep) +import qualified Test.Cardano.Base.QuickCheck as BaseQC import Test.Cardano.Ledger.Allegra.Arbitrary () import Test.Cardano.Ledger.Alonzo.Arbitrary () import Test.Cardano.Ledger.Binary (decoderEquivalenceProp, decoderEquivalenceSpec) @@ -44,7 +45,7 @@ blockEraSpec :: Spec blockEraSpec = prop (show (typeRep $ Proxy @(Block (BHeader StandardCrypto) era))) $ - withMaxSuccess 3 $ + BaseQC.withNumTests 3 $ decoderEquivalenceProp @(Block (BHeader StandardCrypto) era) (eraProtVerLow @era) (eraProtVerHigh @era) diff --git a/libs/cardano-protocol-tpraos/testlib/Test/Cardano/Protocol/Binary/RoundTrip.hs b/libs/cardano-protocol-tpraos/testlib/Test/Cardano/Protocol/Binary/RoundTrip.hs index 0473eae87f8..79dce6338a5 100644 --- a/libs/cardano-protocol-tpraos/testlib/Test/Cardano/Protocol/Binary/RoundTrip.hs +++ b/libs/cardano-protocol-tpraos/testlib/Test/Cardano/Protocol/Binary/RoundTrip.hs @@ -10,6 +10,7 @@ import Cardano.Ledger.Binary (Annotator, DecCBOR, EncCBOR, EncCBORGroup) import Cardano.Ledger.Block (Block) import Cardano.Ledger.Core import Data.Typeable +import qualified Test.Cardano.Base.QuickCheck as BaseQC import Test.Cardano.Ledger.Common import Test.Cardano.Ledger.Core.Binary.Annotator () import Test.Cardano.Ledger.Core.Binary.RoundTrip @@ -31,7 +32,7 @@ roundTripBlockSpec :: Spec roundTripBlockSpec = prop (show (typeRep $ Proxy @(Block h era))) $ do - withMaxSuccess 3 $ do + BaseQC.withNumTests 3 $ do conjoin [ roundTripEraExpectation @era @(Block h era) , roundTripAnnEraExpectation @era @(Block h era) diff --git a/libs/non-integral/non-integral.cabal b/libs/non-integral/non-integral.cabal index 0c36cbdbbe3..70392623ddd 100644 --- a/libs/non-integral/non-integral.cabal +++ b/libs/non-integral/non-integral.cabal @@ -54,4 +54,5 @@ test-suite non-integral-test build-depends: QuickCheck, base, + cardano-base:testlib >=0.1.5.0, non-integral, diff --git a/libs/non-integral/test/Tests/Cardano/Ledger/NonIntegral.hs b/libs/non-integral/test/Tests/Cardano/Ledger/NonIntegral.hs index 227339e5a5e..93ca8fe53d8 100644 --- a/libs/non-integral/test/Tests/Cardano/Ledger/NonIntegral.hs +++ b/libs/non-integral/test/Tests/Cardano/Ledger/NonIntegral.hs @@ -1,3 +1,4 @@ +{-# LANGUAGE CPP #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE PartialTypeSignatures #-} {-# LANGUAGE TypeSynonymInstances #-} @@ -6,6 +7,7 @@ module Tests.Cardano.Ledger.NonIntegral where import Cardano.Ledger.NonIntegral import qualified Data.Fixed as FP +import qualified Test.Cardano.Base.QuickCheck as BaseQC import Test.QuickCheck data E34 @@ -243,7 +245,7 @@ qcWithLabel :: Testable prop => String -> Int -> prop -> IO () qcWithLabel text count prop = do putStrLn text if count > 0 - then quickCheck (withMaxSuccess count prop) + then quickCheck (BaseQC.withNumTests count prop) else putStrLn "--- SKIPPED, takes too long" -- Test of Double -- diff --git a/libs/small-steps/small-steps.cabal b/libs/small-steps/small-steps.cabal index 592042f8315..0d1e4f8b7c3 100644 --- a/libs/small-steps/small-steps.cabal +++ b/libs/small-steps/small-steps.cabal @@ -112,6 +112,7 @@ test-suite tests QuickCheck, Unique, base, + cardano-base:testlib >=0.1.5.0, cardano-crypto-class, cardano-ledger-binary, containers, diff --git a/libs/small-steps/test/Test/Control/State/Transition/Examples/CommitReveal.hs b/libs/small-steps/test/Test/Control/State/Transition/Examples/CommitReveal.hs index dc145a208e5..66169adc1d0 100644 --- a/libs/small-steps/test/Test/Control/State/Transition/Examples/CommitReveal.hs +++ b/libs/small-steps/test/Test/Control/State/Transition/Examples/CommitReveal.hs @@ -34,6 +34,7 @@ import qualified Data.Map.Strict as Map import Data.Set (Set) import qualified Data.Set as Set import Data.Typeable (Typeable) +import qualified Test.Cardano.Base.QuickCheck as BaseQC import qualified Test.Control.State.Transition.Trace as Trace import qualified Test.Control.State.Transition.Trace.Generator.QuickCheck as STS.Gen import Test.QuickCheck ( @@ -44,7 +45,6 @@ import Test.QuickCheck ( elements, oneof, shrink, - withMaxSuccess, ) import Prelude hiding (id) @@ -240,7 +240,7 @@ prop_qc_UniqueData = -- where it shouldn't be possible to shrink @d0@ any further. prop_qc_OnlyValidSignals :: Property prop_qc_OnlyValidSignals = - withMaxSuccess 5000 $ -- We need to test a large + BaseQC.withNumTests 5000 $ -- We need to test a large -- number of times to make sure -- we get a collision in the -- generated data diff --git a/libs/small-steps/test/Test/Control/State/Transition/Examples/Sum.hs b/libs/small-steps/test/Test/Control/State/Transition/Examples/Sum.hs index 3c82260a5bd..51ebe27d2e2 100644 --- a/libs/small-steps/test/Test/Control/State/Transition/Examples/Sum.hs +++ b/libs/small-steps/test/Test/Control/State/Transition/Examples/Sum.hs @@ -9,10 +9,11 @@ module Test.Control.State.Transition.Examples.Sum where import Control.State.Transition import qualified Hedgehog.Gen as Gen import qualified Hedgehog.Range as Range +import qualified Test.Cardano.Base.QuickCheck as BaseQC import Test.Control.State.Transition.Generator import Test.Control.State.Transition.Trace import qualified Test.Control.State.Transition.Trace.Generator.QuickCheck as STS.Gen -import Test.QuickCheck (Property, arbitrary, shrink, withMaxSuccess) +import Test.QuickCheck (Property, arbitrary, shrink) data SUM @@ -58,7 +59,7 @@ prop_qc_Classified = prop_qc_onlyValidSignalsAreGenerated :: Property prop_qc_onlyValidSignalsAreGenerated = - withMaxSuccess 300 $ + BaseQC.withNumTests 300 $ STS.Gen.onlyValidSignalsAreGenerated @SUM @() () 100 () instance STS.Gen.HasTrace SUM () where