diff --git a/cabal.project b/cabal.project index 46aa302d98c..119b80971a8 100644 --- a/cabal.project +++ b/cabal.project @@ -14,9 +14,9 @@ repository cardano-haskell-packages -- update either of these. index-state: -- Bump both the following dates if you need newer packages from Hackage - , hackage.haskell.org 2026-05-19T01:33:52Z + , hackage.haskell.org 2026-06-22T23:30:49Z -- Bump this if you need newer packages from CHaP - , cardano-haskell-packages 2026-05-18T18:23:40Z + , cardano-haskell-packages 2026-06-18T17:45:00Z active-repositories: , :rest @@ -31,7 +31,7 @@ packages: cardano-constitution plutus-metatheory plutus-tx plutus-tx-plugin - doc/docusaurus/docusaurus-examples.cabal + doc/docusaurus -- We never, ever, want this. write-ghc-environment-files: never @@ -93,9 +93,15 @@ allow-newer: , inline-r:containers , inline-r:primitive --- https://github.com/IntersectMBO/plutus/pull/7236 -constraints: setup.optparse-applicative >=0.19.0.0 -allow-newer: turtle:optparse-applicative +constraints: + -- https://github.com/IntersectMBO/plutus/pull/7236 + , setup.optparse-applicative >=0.19.0.0 + +allow-newer: + , deriving-aeson:aeson + , microstache:aeson + , turtle:containers + , turtle:optparse-applicative if impl (ghc >= 9.14) -- https://github.com/snowleopard/alga/issues/322 @@ -104,24 +110,18 @@ if impl (ghc >= 9.14) location: https://github.com/snowleopard/alga tag: d4e43fb42db05413459fb2df493361d5a666588a --- cabal-allow-newer begin -if impl(ghc >= 9.14) allow-newer: - , binary:containers , canonical-json:containers , cborg:base , cborg:containers , config-ini:containers , dependent-map:containers + , dependent-sum:some , dictionary-sharing:containers - , hedgehog-quickcheck:QuickCheck + , monad-control:transformers-compat , ordered-containers:containers , serialise:base , serialise:containers , serialise:time - , tree-diff:time - , turtle:containers , turtle:time , with-utf8:base --- cabal-allow-newer end - diff --git a/cardano-constitution/cardano-constitution.cabal b/cardano-constitution/cardano-constitution.cabal index 1df08f09821..190b91aa71f 100644 --- a/cardano-constitution/cardano-constitution.cabal +++ b/cardano-constitution/cardano-constitution.cabal @@ -82,7 +82,7 @@ library PlutusTx.NonCanonicalRational build-depends: - , aeson + , aeson >=2.3 , base >=4.9 && <5 , containers , filepath diff --git a/flake.lock b/flake.lock index e8c8e4342de..bb966cd86b9 100644 --- a/flake.lock +++ b/flake.lock @@ -3,11 +3,11 @@ "CHaP": { "flake": false, "locked": { - "lastModified": 1779134693, - "narHash": "sha256-2vRtxwIvAX4MOAvetH4lqPoKqQ2g6/mlJoBrhlVrGyk=", + "lastModified": 1781885320, + "narHash": "sha256-xr0r0XFrcG80VDMoTaAV7XCnidWqlP/C3j+CsgI8mGA=", "owner": "IntersectMBO", "repo": "cardano-haskell-packages", - "rev": "a91041c5d000a3016cc09d3621887599a5f1f4f1", + "rev": "74d94f12e2378e3221b000c483c25ebe0de0cb0a", "type": "github" }, "original": { @@ -192,11 +192,11 @@ "hackage": { "flake": false, "locked": { - "lastModified": 1779157593, - "narHash": "sha256-z+Mn/RaGxiPPCF7vmVukPpBgtxy7wPge+SgmUuuemyU=", + "lastModified": 1782176112, + "narHash": "sha256-Ef3P7Eyg+tQgzW5JhH9sjTaPP/u8W26ZhV1ux3CnHyg=", "owner": "input-output-hk", "repo": "hackage.nix", - "rev": "e3a7a69e4baf45f00c59e3c3c86f4c574d07e0d3", + "rev": "d1135528d805c1addb9259b40b9efc626195631f", "type": "github" }, "original": { diff --git a/plutus-benchmark/plutus-benchmark.cabal b/plutus-benchmark/plutus-benchmark.cabal index 06c81633b4f..dc8798fe00b 100644 --- a/plutus-benchmark/plutus-benchmark.cabal +++ b/plutus-benchmark/plutus-benchmark.cabal @@ -926,7 +926,7 @@ executable uplc-evaluator hs-source-dirs: uplc-evaluator ghc-options: -rtsopts -with-rtsopts=-I0 build-depends: - , aeson >=2.0 + , aeson >=2.3 , base >=4.9 && <5 , bytestring , containers @@ -952,7 +952,7 @@ test-suite uplc-evaluator-integration-tests ghc-options: -threaded -rtsopts -with-rtsopts=-N1 build-tool-depends: plutus-benchmark:uplc-evaluator build-depends: - , aeson >=2.0 + , aeson >=2.3 , base >=4.9 && <5 , bytestring , directory diff --git a/plutus-conformance/plutus-conformance.cabal b/plutus-conformance/plutus-conformance.cabal index 3c9f6e5a8d3..18180d74ad8 100644 --- a/plutus-conformance/plutus-conformance.cabal +++ b/plutus-conformance/plutus-conformance.cabal @@ -102,7 +102,7 @@ test-suite agda-conformance hs-source-dirs: agda test-cases other-modules: build-depends: - , aeson + , aeson >=2.3 , base >=4.9 && <5 , plutus-conformance , plutus-core ^>=1.65 diff --git a/plutus-core/plutus-core.cabal b/plutus-core/plutus-core.cabal index 7132d5f6e26..6e795a8b5d1 100644 --- a/plutus-core/plutus-core.cabal +++ b/plutus-core/plutus-core.cabal @@ -313,7 +313,7 @@ library -- * This bound also includes support for the bls12-381 msm primitives (see CIP-133) -- * The bound on 'dependent-sum' is needed to avoid https://github.com/obsidiansystems/dependent-sum/issues/72 build-depends: - , aeson + , aeson >=2.3 , array , barbies , base >=4.9 && <5 @@ -398,10 +398,11 @@ test-suite plutus-core-test default-language: Haskell2010 build-depends: - , aeson + , aeson >=2.3 , base >=4.9 && <5 , base16-bytestring ^>=1.0 , bytestring + , cardano-base:testlib >=0.1.5 , containers , data-default-class , extra @@ -499,6 +500,7 @@ library untyped-plutus-core-testlib , base >=4.9 && <5 , base16-bytestring , bytestring + , cardano-base:testlib >=0.1.5 , cardano-crypto-class , data-default-class , dlist @@ -674,6 +676,7 @@ test-suite plutus-ir-test build-tool-depends: tasty-discover:tasty-discover build-depends: , base >=4.9 && <5 + , cardano-base:testlib >=0.1.5 , containers , filepath , hashable @@ -942,7 +945,7 @@ executable print-cost-model hs-source-dirs: cost-model/print-cost-model other-modules: Paths_plutus_core build-depends: - , aeson + , aeson >=2.3 , base >=4.9 && <5 , bytestring , plutus-core ^>=1.65 @@ -957,7 +960,7 @@ library satint exposed-modules: Data.SatInt hs-source-dirs: satint/src build-depends: - , aeson + , aeson >=2.3 , base >=4.9 && <5 , cassava , deepseq @@ -971,7 +974,8 @@ test-suite satint-test type: exitcode-stdio-1.0 main-is: TestSatInt.hs build-depends: - , base >=4.9 && <5 + , base >=4.9 && <5 + , cardano-base:testlib >=0.1.5 , HUnit , QuickCheck , satint diff --git a/plutus-core/plutus-core/test/Generators/QuickCheck/Utils.hs b/plutus-core/plutus-core/test/Generators/QuickCheck/Utils.hs index c89f7f76d99..0b93f6d055e 100644 --- a/plutus-core/plutus-core/test/Generators/QuickCheck/Utils.hs +++ b/plutus-core/plutus-core/test/Generators/QuickCheck/Utils.hs @@ -10,6 +10,7 @@ import PlutusCore.Generators.QuickCheck.Utils import Test.Tasty import Test.Tasty.QuickCheck +import qualified Test.Cardano.Base.QuickCheck as BaseQC {-| Test that both 'multiSplit1' and 'multiSplit0' produce a list such that 'concat'ing it gives back the input. -} @@ -21,14 +22,14 @@ test_multiSplitSound = , ("multiSplit0", multiSplit0 0.1) ] pure . testProperty name $ \(xs :: [Int]) -> - withMaxSuccess 10000 . forAll (split xs) $ \aSplit -> + BaseQC.withNumTests 10000 . forAll (split xs) $ \aSplit -> xs === concat aSplit -- | Show the distribution of lists generated by a split function for a list of the given length. test_listDistribution :: Int -> ([()] -> Gen [[()]]) -> Int -> TestTree test_listDistribution numRuns split n = testProperty ("for a list of length " ++ show n) $ - withMaxSuccess numRuns . forAll (split $ replicate n ()) $ \aSplit -> + BaseQC.withNumTests numRuns . forAll (split $ replicate n ()) $ \aSplit -> label (show $ map length aSplit) True -- | Count the number of 'I' and 'B' nodes in a 'Data' object. @@ -48,7 +49,7 @@ length of the spine. Ensures that the 'Data' generator is not exponential in 'B' test_arbitraryDataExpectedLeafs :: TestTree test_arbitraryDataExpectedLeafs = testProperty "'arbitrary @Data' has the expected number of 'B' and 'I' leaves" $ - withMaxSuccess 1000 . mapSize (* 5) $ \spine -> + BaseQC.withNumTests 1000 . mapSize (* 5) $ \spine -> forAll (genDataFromSpine spine) $ \dat -> countIandBs dat === length spine diff --git a/plutus-core/plutus-ir/test/PlutusCore/Generators/QuickCheck/BuiltinsTests.hs b/plutus-core/plutus-ir/test/PlutusCore/Generators/QuickCheck/BuiltinsTests.hs index 357c46b3ea6..8e2e191b410 100644 --- a/plutus-core/plutus-ir/test/PlutusCore/Generators/QuickCheck/BuiltinsTests.hs +++ b/plutus-core/plutus-ir/test/PlutusCore/Generators/QuickCheck/BuiltinsTests.hs @@ -4,8 +4,9 @@ import PlutusCore.Data import PlutusCore.Generators.QuickCheck () import Codec.Serialise +import Test.Cardano.Base.QuickCheck qualified as BaseQC import Test.QuickCheck -- | This mainly tests that the `Data` generator isn't non-terminating or too slow. prop_genData :: Property -prop_genData = withMaxSuccess 800 $ \(d :: Data) -> d === deserialise (serialise d) +prop_genData = BaseQC.withNumTests 800 $ \(d :: Data) -> d === deserialise (serialise d) diff --git a/plutus-core/plutus-ir/test/PlutusCore/Generators/QuickCheck/SubstitutionTests.hs b/plutus-core/plutus-ir/test/PlutusCore/Generators/QuickCheck/SubstitutionTests.hs index b35abd29ef8..e1334c2aaab 100644 --- a/plutus-core/plutus-ir/test/PlutusCore/Generators/QuickCheck/SubstitutionTests.hs +++ b/plutus-core/plutus-ir/test/PlutusCore/Generators/QuickCheck/SubstitutionTests.hs @@ -15,6 +15,7 @@ import Data.Set qualified as Set import Data.Set.Lens (setOf) import Data.String +import Test.Cardano.Base.QuickCheck qualified as BaseQC import Test.QuickCheck hiding (choose, vectorOf) -- * Tests for unification and substitution @@ -38,7 +39,7 @@ The statistics at the time this comment was written are as follows: So we don't get great coverage, but given that it takes a few seconds to generate dozens of thousands of (non-filtered) test cases, we do still get some reasonable coverage in the end. -} prop_unify :: Property -prop_unify = withMaxSuccess 500 $ +prop_unify = BaseQC.withNumTests 500 $ forAllDoc "n" arbitrary shrink $ \(NonNegative n) -> forAllDoc "nSub" (choose (0, n)) shrink $ \nSub -> -- See Note [Chaotic Good fresh name generation]. @@ -89,7 +90,7 @@ prop_unifyRename = {-| Check that substitution eliminates from the type all free occurrences of variables present in the domain of the substitution. -} prop_substType :: Property -prop_substType = withMaxSuccess 1000 $ +prop_substType = BaseQC.withNumTests 1000 $ -- No shrinking because every nested shrink makes properties harder to shrink (because you'd need -- to regenerate the stuff that depends on the context, meaning you don't have the same -- counterexample as you did before) and context minimality doesn't help readability very much. diff --git a/plutus-core/plutus-ir/test/PlutusCore/Generators/QuickCheck/TypesTests.hs b/plutus-core/plutus-ir/test/PlutusCore/Generators/QuickCheck/TypesTests.hs index d7f4fc59c11..a6c3eabb518 100644 --- a/plutus-core/plutus-ir/test/PlutusCore/Generators/QuickCheck/TypesTests.hs +++ b/plutus-core/plutus-ir/test/PlutusCore/Generators/QuickCheck/TypesTests.hs @@ -12,6 +12,7 @@ import Control.Monad import Data.Bifunctor import Data.Either import Data.Map.Strict qualified as Map +import Test.Cardano.Base.QuickCheck qualified as BaseQC import Test.QuickCheck prop_genKindCorrect :: Property @@ -21,7 +22,7 @@ prop_genKindCorrect = p_genKindCorrect False See Note [Debugging generators that don't generate well-typed/kinded terms/types] and see the utility tests below when this property fails. -} p_genKindCorrect :: Bool -> Property -p_genKindCorrect debug = withMaxSuccess 1000 $ +p_genKindCorrect debug = BaseQC.withNumTests 1000 $ -- Context minimality doesn't help readability, so no shrinking here forAllDoc "ctx" genCtx (const []) $ \ctx -> -- Note, no shrinking here because shrinking relies on well-kindedness. @@ -30,7 +31,7 @@ p_genKindCorrect debug = withMaxSuccess 1000 $ -- | Check that shrinking types maintains kinds. prop_shrinkTypeSound :: Property -prop_shrinkTypeSound = withMaxSuccess 500 $ +prop_shrinkTypeSound = BaseQC.withNumTests 500 $ forAllDoc "ctx" genCtx (const []) $ \ctx -> forAllDoc "k,ty" (genKindAndTypeWithCtx ctx) (shrinkKindAndType ctx) $ \(k, ty) -> -- See discussion about the same trick in 'prop_shrinkTermSound'. @@ -45,7 +46,7 @@ prop_shrinkTypeSound = withMaxSuccess 500 $ -- | Test that shrinking a type results in a type of a smaller kind. Useful for debugging shrinking. prop_shrinkTypeSmallerKind :: Property -prop_shrinkTypeSmallerKind = withMaxSuccess 3000 $ +prop_shrinkTypeSmallerKind = BaseQC.withNumTests 3000 $ forAllDoc "k,ty" genKindAndType (shrinkKindAndType Map.empty) $ \(k, ty) -> assertNoCounterexamples [ (k', ty') @@ -55,13 +56,13 @@ prop_shrinkTypeSmallerKind = withMaxSuccess 3000 $ -- | Test that shrinking kinds generates smaller kinds. prop_shrinkKindSmaller :: Property -prop_shrinkKindSmaller = withMaxSuccess 30000 $ +prop_shrinkKindSmaller = BaseQC.withNumTests 30000 $ forAllDoc "k" arbitrary shrink $ \k -> assertNoCounterexamples [k' | k' <- shrink k, not $ leKind k' k] -- | Test that fixKind actually gives you something of the right kind. prop_fixKind :: Property -prop_fixKind = withMaxSuccess 10000 $ +prop_fixKind = BaseQC.withNumTests 10000 $ forAllDoc "ctx" genCtx (const []) $ \ctx -> forAllDoc "k,ty" genKindAndType (shrinkKindAndType ctx) $ \(k, ty) -> -- Note, fixKind only works on smaller kinds, so we use shrink to get a definitely smaller kind @@ -74,7 +75,7 @@ prop_fixKind = withMaxSuccess 10000 $ -- | Check that 'normalizeType' returns a normal type. prop_normalizedTypeIsNormal :: Property -prop_normalizedTypeIsNormal = withMaxSuccess 1000 $ +prop_normalizedTypeIsNormal = BaseQC.withNumTests 1000 $ forAllDoc "k,ty" genKindAndType (shrinkKindAndType Map.empty) $ \(_, ty) -> unless (isNormalType . unNormalized . runQuote $ normalizeType ty) $ Left "'normalizeType' returned a non-normal type" diff --git a/plutus-core/plutus-ir/test/PlutusIR/Compiler/Let/Tests.hs b/plutus-core/plutus-ir/test/PlutusIR/Compiler/Let/Tests.hs index 701af43d843..36f07be461d 100644 --- a/plutus-core/plutus-ir/test/PlutusIR/Compiler/Let/Tests.hs +++ b/plutus-core/plutus-ir/test/PlutusIR/Compiler/Let/Tests.hs @@ -15,6 +15,7 @@ import PlutusIR.Compiler qualified as PIR import PlutusIR.Compiler.Let import PlutusIR.Pass.Test import PlutusIR.Test +import Test.Cardano.Base.QuickCheck qualified as BaseQC import Test.QuickCheck import Test.Tasty import Test.Tasty.ExpectedFailure (ignoreTest) @@ -36,7 +37,7 @@ test_lets = test_propLets :: TestTree test_propLets = ignoreTest $ testProperty "lets" $ \letKind -> - withMaxSuccess 40000 $ + BaseQC.withNumTests 40000 $ testPassProp' @_ @_ @_ @(Provenance ()) (Original ()) (\t -> fmap Original t) diff --git a/plutus-core/plutus-ir/test/PlutusIR/Generators/QuickCheck/Tests.hs b/plutus-core/plutus-ir/test/PlutusIR/Generators/QuickCheck/Tests.hs index 81b42caeba5..4a227095a22 100644 --- a/plutus-core/plutus-ir/test/PlutusIR/Generators/QuickCheck/Tests.hs +++ b/plutus-core/plutus-ir/test/PlutusIR/Generators/QuickCheck/Tests.hs @@ -37,6 +37,7 @@ import Data.Either import Data.HashMap.Strict qualified as HashMap import Data.Hashable import Data.Map.Strict qualified as Map +import Test.Cardano.Base.QuickCheck qualified as BaseQC import Test.QuickCheck -- | 'rename' a 'Term' and 'show' it afterwards. @@ -67,7 +68,7 @@ Note, the counterexamples from this property are not shrunk (see why below). See Note [Debugging generators that don't generate well-typed/kinded terms/types] and the utility properties below when this property fails. -} p_genTypeCorrect :: Bool -> Property -p_genTypeCorrect debug = withMaxSuccess 200 $ do +p_genTypeCorrect debug = BaseQC.withNumTests 200 $ do -- Note, we don't shrink this term here because a precondition of shrinking is that -- the term we are shrinking is well-typed. If it is not, the counterexample we get -- from shrinking will be nonsene. @@ -77,7 +78,7 @@ p_genTypeCorrect debug = withMaxSuccess 200 $ do {-| Test that when we generate a fully applied term we end up with a well-typed term. -} prop_genWellTypedFullyApplied :: Property -prop_genWellTypedFullyApplied = withMaxSuccess 50 $ +prop_genWellTypedFullyApplied = BaseQC.withNumTests 50 $ forAllDoc "ty, tm" genTypeAndTerm_ shrinkClosedTypedTerm $ \(ty, tm) -> -- No shrinking here because if `genFullyApplied` is wrong then the shrinking -- will be wrong too. See `prop_genTypeCorrect`. @@ -87,7 +88,7 @@ prop_genWellTypedFullyApplied = withMaxSuccess 50 $ -- | Test that shrinking a well-typed term results in a well-typed term prop_shrinkTermSound :: Property -- The test is disabled, because it's exponential and was hanging CI. -prop_shrinkTermSound = withMaxSuccess 0 $ +prop_shrinkTermSound = BaseQC.withNumTests 0 $ forAllDoc "ty,tm" genTypeAndTerm_ shrinkClosedTypedTerm $ \(ty, tm) -> let shrinks = shrinkClosedTypedTerm (ty, tm) in -- While we generate well-typed terms we still need this check here for @@ -112,7 +113,7 @@ prop_shrinkTermSound = withMaxSuccess 0 $ -- | Test that `findInstantiation` results in a well-typed instantiation. prop_findInstantiation :: Property -prop_findInstantiation = withMaxSuccess 1000 $ +prop_findInstantiation = BaseQC.withNumTests 1000 $ forAllDoc "ctx" genCtx (const []) $ \ctx0 -> forAllDoc "ty" (genTypeWithCtx ctx0 $ Type ()) (shrinkType ctx0) $ \ty0 -> forAllDoc "target" (genTypeWithCtx ctx0 $ Type ()) (shrinkType ctx0) $ \target -> @@ -149,7 +150,7 @@ prop_findInstantiation = withMaxSuccess 1000 $ -- | Check what's in the leaves of the generated data prop_stats_leaves :: Property -prop_stats_leaves = withMaxSuccess 10 $ +prop_stats_leaves = BaseQC.withNumTests 10 $ -- No shrinking here because we are only collecting stats forAllDoc "_,tm" genTypeAndTerm_ (const []) $ \(_, tm) -> tabulate "leaves" (map (filter isAlpha . show . prettyReadable) $ leaves tm) $ property True @@ -168,7 +169,7 @@ prop_stats_leaves = withMaxSuccess 10 $ -- | Check the ratio of duplicate shrinks prop_stats_numShrink :: Property -- The test is disabled, because it's exponential and was hanging CI. -prop_stats_numShrink = withMaxSuccess 0 $ +prop_stats_numShrink = BaseQC.withNumTests 0 $ -- No shrinking here because we are only collecting stats forAllDoc "ty,tm" genTypeAndTerm_ (const []) $ \(ty, tm) -> let shrinks = map snd $ shrinkClosedTypedTerm (ty, tm) @@ -181,7 +182,7 @@ prop_stats_numShrink = withMaxSuccess 0 $ -- | Specific test that `inhabitType` returns well-typed things prop_inhabited :: Property -prop_inhabited = withMaxSuccess 50 $ +prop_inhabited = BaseQC.withNumTests 50 $ -- No shrinking here because if the generator -- generates nonsense shrinking will be nonsense. forAllDoc "ty,tm" (genInhab mempty) (const []) $ @@ -201,7 +202,7 @@ prop_inhabited = withMaxSuccess 50 $ -- | Check that there are no one-step shrink loops prop_noTermShrinkLoops :: Property -- The test is disabled, because it's exponential and was hanging CI. -prop_noTermShrinkLoops = withMaxSuccess 0 +prop_noTermShrinkLoops = BaseQC.withNumTests 0 $ -- Note that we need to remove x from the shrinks of x here because -- a counterexample to this property is otherwise guaranteed to @@ -226,7 +227,7 @@ noStructuralErrors term = -- | Test that evaluation of well-typed terms doesn't fail with a structural error. prop_noStructuralErrors :: Property -prop_noStructuralErrors = withMaxSuccess 99 $ +prop_noStructuralErrors = BaseQC.withNumTests 99 $ forAllDoc "ty,tm" genTypeAndTerm_ shrinkClosedTypedTerm $ \(_, termPir) -> ioProperty $ do termUPlc <- fmap UPLC._progTerm . modifyError (userError . displayException) . toUPlc $ diff --git a/plutus-core/plutus-ir/test/PlutusIR/Transform/Beta/Tests.hs b/plutus-core/plutus-ir/test/PlutusIR/Transform/Beta/Tests.hs index 97dea6ef0ff..c39b53f1ee3 100644 --- a/plutus-core/plutus-ir/test/PlutusIR/Transform/Beta/Tests.hs +++ b/plutus-core/plutus-ir/test/PlutusIR/Transform/Beta/Tests.hs @@ -5,7 +5,8 @@ import PlutusIR.Parser import PlutusIR.Pass.Test import PlutusIR.Test import PlutusIR.Transform.Beta -import Test.QuickCheck.Property (Property, withMaxSuccess) +import Test.Cardano.Base.QuickCheck qualified as BaseQC +import Test.QuickCheck.Property (Property) import Test.Tasty import Test.Tasty.Extras @@ -22,4 +23,4 @@ test_beta = ] prop_beta :: Property -prop_beta = withMaxSuccess numTestsForPassProp $ testPassProp runQuote betaPassSC +prop_beta = BaseQC.withNumTests numTestsForPassProp $ testPassProp runQuote betaPassSC diff --git a/plutus-core/plutus-ir/test/PlutusIR/Transform/CaseOfCase/Tests.hs b/plutus-core/plutus-ir/test/PlutusIR/Transform/CaseOfCase/Tests.hs index 97d5ae7a28f..10aa9e4af3b 100644 --- a/plutus-core/plutus-ir/test/PlutusIR/Transform/CaseOfCase/Tests.hs +++ b/plutus-core/plutus-ir/test/PlutusIR/Transform/CaseOfCase/Tests.hs @@ -9,7 +9,8 @@ import PlutusIR.Pass.Test import PlutusIR.Test import PlutusIR.Transform.CaseOfCase qualified as CaseOfCase import PlutusPrelude -import Test.QuickCheck.Property (Property, withMaxSuccess) +import Test.Cardano.Base.QuickCheck qualified as BaseQC +import Test.QuickCheck.Property (Property) test_caseOfCase :: TestTree test_caseOfCase = @@ -31,6 +32,6 @@ test_caseOfCase = prop_caseOfCase :: Property prop_caseOfCase = - withMaxSuccess numTestsForPassProp $ + BaseQC.withNumTests numTestsForPassProp $ testPassProp runQuote $ \tc -> CaseOfCase.caseOfCasePassSC tc def True mempty diff --git a/plutus-core/plutus-ir/test/PlutusIR/Transform/CaseReduce/Tests.hs b/plutus-core/plutus-ir/test/PlutusIR/Transform/CaseReduce/Tests.hs index e5fb095759f..43ab494303b 100644 --- a/plutus-core/plutus-ir/test/PlutusIR/Transform/CaseReduce/Tests.hs +++ b/plutus-core/plutus-ir/test/PlutusIR/Transform/CaseReduce/Tests.hs @@ -3,7 +3,8 @@ module PlutusIR.Transform.CaseReduce.Tests where import Data.Functor.Identity import PlutusIR.Pass.Test import PlutusIR.Transform.CaseReduce -import Test.QuickCheck.Property (Property, withMaxSuccess) +import Test.Cardano.Base.QuickCheck qualified as BaseQC +import Test.QuickCheck.Property (Property) prop_caseReduce :: Property -prop_caseReduce = withMaxSuccess numTestsForPassProp $ testPassProp runIdentity caseReducePass +prop_caseReduce = BaseQC.withNumTests numTestsForPassProp $ testPassProp runIdentity caseReducePass diff --git a/plutus-core/plutus-ir/test/PlutusIR/Transform/DeadCode/Tests.hs b/plutus-core/plutus-ir/test/PlutusIR/Transform/DeadCode/Tests.hs index 9920a7cbcdb..88e20aec21a 100644 --- a/plutus-core/plutus-ir/test/PlutusIR/Transform/DeadCode/Tests.hs +++ b/plutus-core/plutus-ir/test/PlutusIR/Transform/DeadCode/Tests.hs @@ -11,6 +11,7 @@ import PlutusIR.Pass.Test import PlutusIR.Test import PlutusIR.Transform.DeadCode import PlutusPrelude +import Test.Cardano.Base.QuickCheck qualified as BaseQC import Test.Tasty.ExpectedFailure (ignoreTest) import Test.Tasty.QuickCheck @@ -41,7 +42,7 @@ test_deadCode = -- this test sometimes fails so ignoring it to make CI pass. typecheckRemoveDeadBindingsProp :: BuiltinSemanticsVariant DefaultFun -> Property typecheckRemoveDeadBindingsProp biVariant = - withMaxSuccess (3 * numTestsForPassProp) + BaseQC.withNumTests (3 * numTestsForPassProp) $ testPassProp runQuote $ \tc -> removeDeadBindingsPassSC tc (def {_biSemanticsVariant = biVariant}) diff --git a/plutus-core/plutus-ir/test/PlutusIR/Transform/EvaluateBuiltins/Tests.hs b/plutus-core/plutus-ir/test/PlutusIR/Transform/EvaluateBuiltins/Tests.hs index 1595e1d3c3d..02bb5399cc3 100644 --- a/plutus-core/plutus-ir/test/PlutusIR/Transform/EvaluateBuiltins/Tests.hs +++ b/plutus-core/plutus-ir/test/PlutusIR/Transform/EvaluateBuiltins/Tests.hs @@ -11,7 +11,8 @@ import PlutusIR.Pass.Test import PlutusIR.Test import PlutusIR.Transform.EvaluateBuiltins import PlutusPrelude -import Test.QuickCheck.Property (Property, withMaxSuccess) +import Test.Cardano.Base.QuickCheck qualified as BaseQC +import Test.QuickCheck.Property (Property) test_evaluateBuiltins :: TestTree test_evaluateBuiltins = @@ -44,7 +45,7 @@ test_evaluateBuiltins = prop_evaluateBuiltins :: Bool -> BuiltinSemanticsVariant DefaultFun -> Property prop_evaluateBuiltins conservative biVariant = - withMaxSuccess numTestsForPassProp + BaseQC.withNumTests numTestsForPassProp $ testPassProp runIdentity $ \tc -> evaluateBuiltinsPass tc conservative (def {_biSemanticsVariant = biVariant}) def diff --git a/plutus-core/plutus-ir/test/PlutusIR/Transform/Inline/Tests.hs b/plutus-core/plutus-ir/test/PlutusIR/Transform/Inline/Tests.hs index 1d2d1a65630..357a72a07a6 100644 --- a/plutus-core/plutus-ir/test/PlutusIR/Transform/Inline/Tests.hs +++ b/plutus-core/plutus-ir/test/PlutusIR/Transform/Inline/Tests.hs @@ -10,7 +10,8 @@ import PlutusIR.Pass.Test import PlutusIR.Test import PlutusIR.Transform.Inline.Inline import PlutusPrelude -import Test.QuickCheck.Property (Property, withMaxSuccess) +import Test.Cardano.Base.QuickCheck qualified as BaseQC +import Test.QuickCheck.Property (Property) import Test.Tasty (TestTree) -- | Tests of the inliner, include global uniqueness test. @@ -73,7 +74,7 @@ test_inline = prop_inline :: BuiltinSemanticsVariant DefaultFun -> Property prop_inline biVariant = - withMaxSuccess numTestsForPassProp + BaseQC.withNumTests numTestsForPassProp $ testPassProp runQuote $ \tc -> inlinePassSC 0 0 True tc def (def {_biSemanticsVariant = biVariant}) diff --git a/plutus-core/plutus-ir/test/PlutusIR/Transform/KnownCon/Tests.hs b/plutus-core/plutus-ir/test/PlutusIR/Transform/KnownCon/Tests.hs index afac656be64..18f2fee2c4a 100644 --- a/plutus-core/plutus-ir/test/PlutusIR/Transform/KnownCon/Tests.hs +++ b/plutus-core/plutus-ir/test/PlutusIR/Transform/KnownCon/Tests.hs @@ -8,6 +8,7 @@ import PlutusIR.Parser import PlutusIR.Pass.Test import PlutusIR.Test import PlutusIR.Transform.KnownCon qualified as KnownCon +import Test.Cardano.Base.QuickCheck qualified as BaseQC import Test.QuickCheck test_knownCon :: TestTree @@ -25,4 +26,4 @@ test_knownCon = ] prop_knownCon :: Property -prop_knownCon = withMaxSuccess numTestsForPassProp $ testPassProp runQuote KnownCon.knownConPassSC +prop_knownCon = BaseQC.withNumTests numTestsForPassProp $ testPassProp runQuote KnownCon.knownConPassSC diff --git a/plutus-core/plutus-ir/test/PlutusIR/Transform/LetFloatIn/Tests.hs b/plutus-core/plutus-ir/test/PlutusIR/Transform/LetFloatIn/Tests.hs index 1a975418376..c7af86b7224 100644 --- a/plutus-core/plutus-ir/test/PlutusIR/Transform/LetFloatIn/Tests.hs +++ b/plutus-core/plutus-ir/test/PlutusIR/Transform/LetFloatIn/Tests.hs @@ -14,7 +14,8 @@ import PlutusIR.Transform.LetFloatIn qualified as LetFloatIn import PlutusIR.Transform.LetMerge qualified as LetMerge import PlutusIR.Transform.Rename () import PlutusPrelude -import Test.QuickCheck.Property (Property, withMaxSuccess) +import Test.Cardano.Base.QuickCheck qualified as BaseQC +import Test.QuickCheck.Property (Property) test_letFloatInConservative :: TestTree test_letFloatInConservative = @@ -59,7 +60,7 @@ test_letFloatInRelaxed = prop_floatIn :: BuiltinSemanticsVariant PLC.DefaultFun -> Bool -> Property prop_floatIn biVariant conservative = - withMaxSuccess numTestsForPassProp $ testPassProp runQuote testPass + BaseQC.withNumTests numTestsForPassProp $ testPassProp runQuote testPass where testPass tcconfig = LetFloatIn.floatTermPassSC diff --git a/plutus-core/plutus-ir/test/PlutusIR/Transform/LetFloatOut/Tests.hs b/plutus-core/plutus-ir/test/PlutusIR/Transform/LetFloatOut/Tests.hs index c140b19639b..f04a5668f85 100644 --- a/plutus-core/plutus-ir/test/PlutusIR/Transform/LetFloatOut/Tests.hs +++ b/plutus-core/plutus-ir/test/PlutusIR/Transform/LetFloatOut/Tests.hs @@ -17,7 +17,8 @@ import PlutusIR.Transform.LetMerge qualified as LetMerge import PlutusIR.Transform.RecSplit qualified as RecSplit import PlutusIR.Transform.Rename () import PlutusPrelude -import Test.QuickCheck.Property (Property, withMaxSuccess) +import Test.Cardano.Base.QuickCheck qualified as BaseQC +import Test.QuickCheck.Property (Property) test_letFloatOut :: TestTree test_letFloatOut = @@ -66,7 +67,7 @@ test_letFloatOut = <> LetMerge.letMergePass tcconfig prop_floatOut :: BuiltinSemanticsVariant PLC.DefaultFun -> Property -prop_floatOut biVariant = withMaxSuccess numTestsForPassProp $ testPassProp runQuote testPass +prop_floatOut biVariant = BaseQC.withNumTests numTestsForPassProp $ testPassProp runQuote testPass where testPass tcconfig = LetFloatOut.floatTermPassSC diff --git a/plutus-core/plutus-ir/test/PlutusIR/Transform/NonStrict/Tests.hs b/plutus-core/plutus-ir/test/PlutusIR/Transform/NonStrict/Tests.hs index ae3dba0cbc8..6ca86a6670c 100644 --- a/plutus-core/plutus-ir/test/PlutusIR/Transform/NonStrict/Tests.hs +++ b/plutus-core/plutus-ir/test/PlutusIR/Transform/NonStrict/Tests.hs @@ -9,6 +9,7 @@ import PlutusIR.Pass.Test import PlutusIR.Test import PlutusIR.Transform.NonStrict qualified as NonStrict import PlutusIR.Transform.Rename () +import Test.Cardano.Base.QuickCheck qualified as BaseQC import Test.QuickCheck test_nonStrict :: TestTree @@ -26,6 +27,6 @@ test_nonStrict = ] prop_nonStrict :: Bool -> Property -prop_nonStrict useUnit = withMaxSuccess numTestsForPassProp $ +prop_nonStrict useUnit = BaseQC.withNumTests numTestsForPassProp $ testPassProp runQuote $ \tc -> NonStrict.compileNonStrictBindingsPassSC tc useUnit diff --git a/plutus-core/plutus-ir/test/PlutusIR/Transform/RecSplit/Tests.hs b/plutus-core/plutus-ir/test/PlutusIR/Transform/RecSplit/Tests.hs index 0cd1a40234f..3782a9032d0 100644 --- a/plutus-core/plutus-ir/test/PlutusIR/Transform/RecSplit/Tests.hs +++ b/plutus-core/plutus-ir/test/PlutusIR/Transform/RecSplit/Tests.hs @@ -9,6 +9,7 @@ import PlutusIR.Parser import PlutusIR.Pass.Test import PlutusIR.Test import PlutusIR.Transform.RecSplit +import Test.Cardano.Base.QuickCheck qualified as BaseQC import Test.Tasty.QuickCheck test_recSplit :: TestTree @@ -26,4 +27,4 @@ test_recSplit = prop_recSplit :: Property prop_recSplit = - withMaxSuccess numTestsForPassProp $ testPassProp runIdentity recSplitPass + BaseQC.withNumTests numTestsForPassProp $ testPassProp runIdentity recSplitPass diff --git a/plutus-core/plutus-ir/test/PlutusIR/Transform/Rename/Tests.hs b/plutus-core/plutus-ir/test/PlutusIR/Transform/Rename/Tests.hs index 810277a078d..48bb2cf1a67 100644 --- a/plutus-core/plutus-ir/test/PlutusIR/Transform/Rename/Tests.hs +++ b/plutus-core/plutus-ir/test/PlutusIR/Transform/Rename/Tests.hs @@ -9,6 +9,7 @@ import PlutusIR.Pass import PlutusIR.Pass.Test import PlutusIR.Test import PlutusIR.Transform.Rename () +import Test.Cardano.Base.QuickCheck qualified as BaseQC import Test.Tasty.QuickCheck test_rename :: TestTree @@ -25,4 +26,4 @@ test_rename = prop_rename :: Property prop_rename = - withMaxSuccess numTestsForPassProp $ testPassProp runQuote (const renamePass) + BaseQC.withNumTests numTestsForPassProp $ testPassProp runQuote (const renamePass) diff --git a/plutus-core/plutus-ir/test/PlutusIR/Transform/RewriteRules/Tests.hs b/plutus-core/plutus-ir/test/PlutusIR/Transform/RewriteRules/Tests.hs index f839c8db161..bc2643b01d9 100644 --- a/plutus-core/plutus-ir/test/PlutusIR/Transform/RewriteRules/Tests.hs +++ b/plutus-core/plutus-ir/test/PlutusIR/Transform/RewriteRules/Tests.hs @@ -9,6 +9,7 @@ import PlutusIR.Test import PlutusIR.Transform.RewriteRules as RewriteRules import PlutusPrelude +import Test.Cardano.Base.QuickCheck qualified as BaseQC import Test.QuickCheck import Test.Tasty @@ -36,4 +37,4 @@ test_rewriteRules = prop_rewriteRules :: Property prop_rewriteRules = - withMaxSuccess numTestsForPassProp $ testPassProp runQuote $ \tc -> rewritePassSC tc def + BaseQC.withNumTests numTestsForPassProp $ testPassProp runQuote $ \tc -> rewritePassSC tc def diff --git a/plutus-core/plutus-ir/test/PlutusIR/Transform/StrictifyBindings/Tests.hs b/plutus-core/plutus-ir/test/PlutusIR/Transform/StrictifyBindings/Tests.hs index ba175d2945f..434a9bd560b 100644 --- a/plutus-core/plutus-ir/test/PlutusIR/Transform/StrictifyBindings/Tests.hs +++ b/plutus-core/plutus-ir/test/PlutusIR/Transform/StrictifyBindings/Tests.hs @@ -11,7 +11,8 @@ import PlutusIR.Pass.Test import PlutusIR.Test import PlutusIR.Transform.StrictifyBindings import PlutusPrelude -import Test.QuickCheck.Property (Property, withMaxSuccess) +import Test.Cardano.Base.QuickCheck qualified as BaseQC +import Test.QuickCheck.Property (Property) test_strictifyBindings :: TestTree test_strictifyBindings = @@ -29,7 +30,7 @@ test_strictifyBindings = prop_strictifyBindings :: BuiltinSemanticsVariant DefaultFun -> Property prop_strictifyBindings biVariant = - withMaxSuccess numTestsForPassProp + BaseQC.withNumTests numTestsForPassProp $ testPassProp runIdentity $ \tc -> strictifyBindingsPass tc (def {_biSemanticsVariant = biVariant}) diff --git a/plutus-core/plutus-ir/test/PlutusIR/Transform/ThunkRecursions/Tests.hs b/plutus-core/plutus-ir/test/PlutusIR/Transform/ThunkRecursions/Tests.hs index 98f6d17f28d..5596d369fb7 100644 --- a/plutus-core/plutus-ir/test/PlutusIR/Transform/ThunkRecursions/Tests.hs +++ b/plutus-core/plutus-ir/test/PlutusIR/Transform/ThunkRecursions/Tests.hs @@ -13,7 +13,8 @@ import PlutusIR.Test import PlutusIR.Transform.Rename () import PlutusIR.Transform.ThunkRecursions import PlutusPrelude -import Test.QuickCheck.Property (Property, withMaxSuccess) +import Test.Cardano.Base.QuickCheck qualified as BaseQC +import Test.QuickCheck.Property (Property) test_thunkRecursions :: TestTree test_thunkRecursions = @@ -31,6 +32,6 @@ test_thunkRecursions = prop_thunkRecursions :: BuiltinSemanticsVariant DefaultFun -> Property prop_thunkRecursions biVariant = - withMaxSuccess numTestsForPassProp $ + BaseQC.withNumTests numTestsForPassProp $ testPassProp runIdentity $ \tc -> thunkRecursionsPass tc (def {_biSemanticsVariant = biVariant}) diff --git a/plutus-core/plutus-ir/test/PlutusIR/Transform/Unwrap/Tests.hs b/plutus-core/plutus-ir/test/PlutusIR/Transform/Unwrap/Tests.hs index 5ea1139ad90..09168151979 100644 --- a/plutus-core/plutus-ir/test/PlutusIR/Transform/Unwrap/Tests.hs +++ b/plutus-core/plutus-ir/test/PlutusIR/Transform/Unwrap/Tests.hs @@ -9,7 +9,8 @@ import PlutusIR.Test import PlutusIR.Transform.Unwrap import Data.Functor.Identity -import Test.QuickCheck.Property (Property, withMaxSuccess) +import Test.Cardano.Base.QuickCheck qualified as BaseQC +import Test.QuickCheck.Property (Property) test_unwrap :: TestTree test_unwrap = @@ -21,4 +22,4 @@ test_unwrap = prop_unwrap :: Property prop_unwrap = - withMaxSuccess numTestsForPassProp $ testPassProp runIdentity unwrapCancelPass + BaseQC.withNumTests numTestsForPassProp $ testPassProp runIdentity unwrapCancelPass diff --git a/plutus-core/satint/test/TestSatInt.hs b/plutus-core/satint/test/TestSatInt.hs index 3a71183bb09..a5732138ea5 100644 --- a/plutus-core/satint/test/TestSatInt.hs +++ b/plutus-core/satint/test/TestSatInt.hs @@ -12,6 +12,7 @@ import Control.Exception as E import Data.List import Data.Maybe import Data.SatInt +import qualified Test.Cardano.Base.QuickCheck as BaseQC import Test.Framework as TF import Test.Framework.Providers.HUnit import Test.Framework.Providers.QuickCheck2 @@ -80,9 +81,9 @@ tests = , testProperty "+" (propBinOp (+)) , testProperty "-" (propBinOp (-)) , testProperty "/0" propDividedBy0 - , testProperty "plusSI" (withMaxSuccess 10000 propPlusSI) - , testProperty "minusSI" (withMaxSuccess 10000 propMinusSI) - , testProperty "timesSI" (withMaxSuccess 10000 propTimesSI) + , testProperty "plusSI" (BaseQC.withNumTests 10000 propPlusSI) + , testProperty "minusSI" (BaseQC.withNumTests 10000 propMinusSI) + , testProperty "timesSI" (BaseQC.withNumTests 10000 propTimesSI) -- lcm and gcd do *not* pass `behavesOk` since they *internally* use `abs` (which will give the wrong/saturated -- answer for minBound), and hence go astray after that. But we can't easily detect that this is the "correct" -- saturated thing to do as we do for other operations (where we can just see if the saturating version is @@ -95,13 +96,13 @@ intWithSpecialCases :: Gen Int intWithSpecialCases = frequency [(1, pure (-1)), (1, pure minBound), (1, pure maxBound), (80, arbitrary)] propBinOp :: (forall a. Num a => a -> a -> a) -> Property -propBinOp (!) = withMaxSuccess 10000 $ +propBinOp (!) = BaseQC.withNumTests 10000 $ forAll intWithSpecialCases $ \x -> forAll intWithSpecialCases $ \y -> ioProperty $ behavesOk (fromIntegral x ! fromIntegral y) propDividedBy0 :: Property -propDividedBy0 = withMaxSuccess 1000 $ +propDividedBy0 = BaseQC.withNumTests 1000 $ forAll intWithSpecialCases $ \n -> saturatesPos ((fromIntegral n) `dividedBy` 0) diff --git a/plutus-core/untyped-plutus-core/testlib/Evaluation/Builtins/BLS12_381.hs b/plutus-core/untyped-plutus-core/testlib/Evaluation/Builtins/BLS12_381.hs index e45431a3555..83f19a51b0c 100644 --- a/plutus-core/untyped-plutus-core/testlib/Evaluation/Builtins/BLS12_381.hs +++ b/plutus-core/untyped-plutus-core/testlib/Evaluation/Builtins/BLS12_381.hs @@ -44,6 +44,7 @@ import Data.List as List ) import Text.Printf (printf) +import Test.Cardano.Base.QuickCheck qualified as BaseQC import Test.QuickCheck hiding (Some (..)) import Test.Tasty import Test.Tasty.QuickCheck hiding (Some (..)) @@ -56,7 +57,7 @@ mkTestName :: forall g. TestableAbelianGroup g => String -> String mkTestName s = printf "%s_%s" (groupName @g) s withNTests :: Testable prop => prop -> Property -withNTests = withMaxSuccess 200 +withNTests = BaseQC.withNumTests 200 -- QuickCheck generators for scalars and group elements as PLC terms @@ -410,7 +411,7 @@ test_uncompress_out_of_group :: forall g. HashAndCompress g => TestTree test_uncompress_out_of_group = testProperty (mkTestName @g "uncompress_out_of_group") - . withMaxSuccess 99 + . BaseQC.withNumTests 99 $ do b <- suchThat (resize 128 arbitrary) correctSize let b' = setBits compressionBit $ clearBits infinityBit b @@ -488,7 +489,7 @@ test_no_hash_collisions = let emptyBS = bytestring BS.empty in testProperty (mkTestName @g "no_hash_collisions") - . withMaxSuccess 1 + . BaseQC.withNumTests 1 $ do msgs <- nub <$> replicateM numHashCollisionInputs arbitrary let terms = fmap (\msg -> hashToGroupTerm @g (bytestring msg) emptyBS) msgs @@ -508,7 +509,7 @@ test_no_hash_collisions_dst = maxDstSize = 255 in testProperty (mkTestName @g "no_hash_collisions_dst") - . withMaxSuccess 1 + . BaseQC.withNumTests 1 $ do dsts <- nub <$> replicateM numHashCollisionInputs (resize maxDstSize arbitrary) let terms = fmap (\dst -> hashToGroupTerm @g msg (bytestring dst)) dsts diff --git a/plutus-core/untyped-plutus-core/testlib/Evaluation/Builtins/Costing.hs b/plutus-core/untyped-plutus-core/testlib/Evaluation/Builtins/Costing.hs index f0b8c1346ae..ade176ca929 100644 --- a/plutus-core/untyped-plutus-core/testlib/Evaluation/Builtins/Costing.hs +++ b/plutus-core/untyped-plutus-core/testlib/Evaluation/Builtins/Costing.hs @@ -20,6 +20,8 @@ import Data.Int import Data.List import Data.Maybe import Data.SatInt + +import Test.Cardano.Base.QuickCheck qualified as BaseQC import Test.QuickCheck.Gen import Test.Tasty import Test.Tasty.QuickCheck hiding (Some (..)) @@ -140,7 +142,7 @@ test_magnitudes = -- | Show the distribution of generated 'CostStream's as a diagnostic. test_CostStreamDistribution :: TestTree test_CostStreamDistribution = - testProperty "distribution of the generated CostStream values" . withMaxSuccess 10000 $ + testProperty "distribution of the generated CostStream values" . BaseQC.withNumTests 10000 $ \costs -> let costsSum = sumCostStream costs (low, high) = toRange costsSum @@ -149,7 +151,7 @@ test_CostStreamDistribution = -- | Test that @fromCostList . toCostList@ is identity. test_toCostListRoundtrip :: TestTree test_toCostListRoundtrip = - testProperty "fromCostList cancels toCostList" . withMaxSuccess 5000 $ \costs -> + testProperty "fromCostList cancels toCostList" . BaseQC.withNumTests 5000 $ \costs -> checkEqualsVia eqCostStream (fromCostList $ toCostList costs) @@ -158,14 +160,14 @@ test_toCostListRoundtrip = -- | Test that @toCostList . fromCostList@ is identity. test_fromCostListRoundtrip :: TestTree test_fromCostListRoundtrip = - testProperty "toCostList cancels fromCostList" . withMaxSuccess 5000 $ \costs -> + testProperty "toCostList cancels fromCostList" . BaseQC.withNumTests 5000 $ \costs -> toCostList (fromCostList costs) === costs -- | Test that @uncurry reconsCost . unconsCost@ is identity. test_unconsCostRoundtrip :: TestTree test_unconsCostRoundtrip = - testProperty "reconsCost cancels unconsCost" . withMaxSuccess 5000 $ \costs -> + testProperty "reconsCost cancels unconsCost" . BaseQC.withNumTests 5000 $ \costs -> checkEqualsVia eqCostStream (uncurry reconsCost $ unconsCost costs) @@ -174,14 +176,14 @@ test_unconsCostRoundtrip = -- | Test that 'sumCostStream' returns the sum of the elements of a 'CostStream'. test_sumCostStreamIsSum :: TestTree test_sumCostStreamIsSum = - testProperty "sumCostStream is sum" . withMaxSuccess 5000 $ \costs -> + testProperty "sumCostStream is sum" . BaseQC.withNumTests 5000 $ \costs -> sumCostStream costs === sum (toCostList costs) -- | Test that 'mapCostStream' applies a function to each element of a 'CostStream'. test_mapCostStreamIsMap :: TestTree test_mapCostStreamIsMap = - testProperty "mapCostStream is map" . withMaxSuccess 500 $ \(Fun _ f) costs -> + testProperty "mapCostStream is map" . BaseQC.withNumTests 500 $ \(Fun _ f) costs -> checkEqualsVia eqCostStream (mapCostStream f $ fromCostList costs) @@ -191,7 +193,7 @@ test_mapCostStreamIsMap = arguments. -} test_addCostStreamIsAdd :: TestTree test_addCostStreamIsAdd = - testProperty "addCostStream is add" . withMaxSuccess 5000 $ \costs1 costs2 -> + testProperty "addCostStream is add" . BaseQC.withNumTests 5000 $ \costs1 costs2 -> sumCostStream (addCostStream costs1 costs2) === sumCostStream costs1 + sumCostStream costs2 @@ -200,7 +202,7 @@ test_addCostStreamIsAdd = two arguments. -} test_minCostStreamIsMin :: TestTree test_minCostStreamIsMin = - testProperty "minCostStream is min" . withMaxSuccess 5000 $ \costs1 costs2 -> + testProperty "minCostStream is min" . BaseQC.withNumTests 5000 $ \costs1 costs2 -> sumCostStream (minCostStream costs1 costs2) === min (sumCostStream costs1) (sumCostStream costs2) @@ -208,14 +210,14 @@ test_minCostStreamIsMin = sums of its two arguments. -} test_zipCostStreamIsZip :: TestTree test_zipCostStreamIsZip = - testProperty "zipCostStream is zip" . withMaxSuccess 5000 $ \costs1 costs2 -> + testProperty "zipCostStream is zip" . BaseQC.withNumTests 5000 $ \costs1 costs2 -> sumExBudgetStream (zipCostStream costs1 costs2) === ExBudget (ExCPU $ sumCostStream costs1) (ExMemory $ sumCostStream costs2) -- | Test that 'mapCostStream' preserves the length of the stream. test_mapCostStreamReasonableLength :: TestTree test_mapCostStreamReasonableLength = - testProperty "mapCostStream: reasonable length" . withMaxSuccess 500 $ \(Fun _ f) costs -> + testProperty "mapCostStream: reasonable length" . BaseQC.withNumTests 500 $ \(Fun _ f) costs -> length (toCostList (mapCostStream f costs)) === length (toCostList costs) @@ -223,7 +225,7 @@ test_mapCostStreamReasonableLength = its two arguments. -} test_addCostStreamReasonableLength :: TestTree test_addCostStreamReasonableLength = - testProperty "addCostStream: reasonable length " . withMaxSuccess 5000 $ \costs1 costs2 -> + testProperty "addCostStream: reasonable length " . BaseQC.withNumTests 5000 $ \costs1 costs2 -> max 2 (length (toCostList (addCostStream costs1 costs2))) === length (toCostList costs1) + length (toCostList costs2) @@ -234,7 +236,7 @@ test_addCostStreamReasonableLength = 2. smaller than or equal to the sum of the lengths of its two arguments. -} test_minCostStreamReasonableLength :: TestTree test_minCostStreamReasonableLength = - testProperty "minCostStream: reasonable length " . withMaxSuccess 5000 $ \costs1 costs2 -> + testProperty "minCostStream: reasonable length " . BaseQC.withNumTests 5000 $ \costs1 costs2 -> let len1 = length $ toCostList costs1 len2 = length $ toCostList costs2 lenMin = length . toCostList $ minCostStream costs1 costs2 @@ -244,14 +246,14 @@ test_minCostStreamReasonableLength = lengths of its two arguments. -} test_zipCostStreamReasonableLength :: TestTree test_zipCostStreamReasonableLength = - testProperty "zipCostStream: reasonable length " . withMaxSuccess 5000 $ \costs1 costs2 -> + testProperty "zipCostStream: reasonable length " . BaseQC.withNumTests 5000 $ \costs1 costs2 -> length (toExBudgetList (zipCostStream costs1 costs2)) === max (length (toCostList costs1)) (length (toCostList costs2)) -- | Test that 'mapCostStream' preserves the laziness of its argument. test_mapCostStreamHandlesBottom :: TestTree test_mapCostStreamHandlesBottom = - testProperty "mapCostStream handles bottom suffixes" . withMaxSuccess 500 $ \(Fun _ f) xs -> + testProperty "mapCostStream handles bottom suffixes" . BaseQC.withNumTests 500 $ \(Fun _ f) xs -> let n = length xs -- 'fromCostList' forces an additional element, so we account for that here. suff = 0 : bottom @@ -261,7 +263,7 @@ test_mapCostStreamHandlesBottom = -- | Test that 'mapCostStream' preserves the laziness of its two arguments. test_addCostStreamHandlesBottom :: TestTree test_addCostStreamHandlesBottom = - testProperty "addCostStream handles bottom suffixes" . withMaxSuccess 5000 $ \(Positive n) -> + testProperty "addCostStream handles bottom suffixes" . BaseQC.withNumTests 5000 $ \(Positive n) -> let interleave xs ys = concat $ transpose [xs, ys] zeroToN = map (unsafeToSatInt . fromIntegral) [0 .. n] ++ bottom nPlus1To2NPlus1 = map (unsafeToSatInt . fromIntegral) [n + 1 .. n * 2 + 1] ++ bottom @@ -280,7 +282,7 @@ test_addCostStreamHandlesBottom = -- | Test that 'minCostStream' preserves the laziness of its two arguments. test_minCostStreamHandlesBottom :: TestTree test_minCostStreamHandlesBottom = - testProperty "minCostStream handles bottom suffixes" . withMaxSuccess 5000 $ \xs ys -> + testProperty "minCostStream handles bottom suffixes" . BaseQC.withNumTests 5000 $ \xs ys -> let m = min (sum xs) (sum ys) -- 'minCostStream' can force only a single extra element of the stream. suff = 0 : bottom @@ -307,7 +309,7 @@ postAlignWith z xs ys = (align xs, align ys) -- | Test that 'zipCostStream' preserves the laziness of its two arguments. test_zipCostStreamHandlesBottom :: TestTree test_zipCostStreamHandlesBottom = - testProperty "zipCostStream handles bottom suffixes" . withMaxSuccess 5000 $ \xs ys -> + testProperty "zipCostStream handles bottom suffixes" . BaseQC.withNumTests 5000 $ \xs ys -> let z = ExBudget (ExCPU $ sum xs) (ExMemory $ sum ys) (xsA, ysA) = postAlignWith 0 xs ys -- 'fromCostList' forces an additional element, so we account for that here. @@ -340,7 +342,7 @@ test_flattenCostRoseIsLinearForSierpinskiRose :: Int -> TestTree test_flattenCostRoseIsLinearForSierpinskiRose depth = let size = sierpinskiSize depth in testProperty ("sierpinski rose: taking " ++ show size ++ " elements") $ - withMaxSuccess 1 $ + BaseQC.withNumTests 1 $ length (toCostList . flattenCostRose $ sierpinskiRose depth) === size @@ -400,7 +402,7 @@ collectListLengths (CostRose _ costs) = length costs : concatMap collectListLeng test_CostRoseListLengthsDistribution :: TestTree test_CostRoseListLengthsDistribution = testProperty "distribution of list lengths in CostRose values" $ - withMaxSuccess 1000 $ \rose -> + BaseQC.withNumTests 1000 $ \rose -> let render n | n <= 10 = show n | otherwise = show m ++ " < n <= " ++ show (m + 10) @@ -412,7 +414,7 @@ test_CostRoseListLengthsDistribution = test_genCostRoseSound :: TestTree test_genCostRoseSound = testProperty "genCostRose puts 100% of its input and nothing else into the output" $ - withMaxSuccess 1000 $ \costs -> + BaseQC.withNumTests 1000 $ \costs -> forAll (genCostRose costs) $ \rose -> fromCostRose rose === costs @@ -421,7 +423,7 @@ test_genCostRoseSound = test_flattenCostRoseSound :: TestTree test_flattenCostRoseSound = testProperty "flattenCostRose puts 100% of its input and nothing else into the output" $ - withMaxSuccess 1000 $ \rose -> + BaseQC.withNumTests 1000 $ \rose -> -- This assumes that 'flattenCostRose' is left-biased, which isn't really necessary, but -- it doesn't seem like we're giving up on the assumption any time soon anyway, so why -- not keep it simple instead of sorting the results. @@ -433,7 +435,7 @@ test_flattenCostRoseSound = -- | Test that 'flattenCostRose' is lazy. test_flattenCostRoseHandlesBottom :: TestTree test_flattenCostRoseHandlesBottom = - testProperty "flattenCostRose handles bottom subtrees" . withMaxSuccess 5000 $ \xs ys -> + testProperty "flattenCostRose handles bottom subtrees" . BaseQC.withNumTests 5000 $ \xs ys -> -- Create a 'CostRose' with a negative cost somewhere in it, then replace the subtree after -- that cost with 'bottom' and check that we can get to the negative cost without forcing -- the bottom. We could've implemented generation of 'CostRose's with bottoms in them, but @@ -454,7 +456,7 @@ containing a negative cost. -} test_costsAreNeverNegative :: TestTree test_costsAreNeverNegative = testProperty "costs coming from 'memoryUsage' are never negative" $ - withMaxSuccess 1000 $ \(val :: Some (ValueOf DefaultUni)) -> + BaseQC.withNumTests 1000 $ \(val :: Some (ValueOf DefaultUni)) -> all (>= 0) . toCostList . flattenCostRose $ memoryUsage val test_costing :: TestTree diff --git a/plutus-core/untyped-plutus-core/testlib/Evaluation/Builtins/Definition.hs b/plutus-core/untyped-plutus-core/testlib/Evaluation/Builtins/Definition.hs index f8e03b0f974..a35ae79ed88 100644 --- a/plutus-core/untyped-plutus-core/testlib/Evaluation/Builtins/Definition.hs +++ b/plutus-core/untyped-plutus-core/testlib/Evaluation/Builtins/Definition.hs @@ -81,6 +81,7 @@ import Hedgehog (forAll, property, withTests, (===)) import Hedgehog.Gen qualified as Gen import Hedgehog.Range qualified as Range import Prettyprinter (vsep) +import Test.Cardano.Base.QuickCheck qualified as BaseQC import Test.Tasty (TestTree, testGroup) import Test.Tasty.HUnit (Assertion, assertBool, assertFailure, testCase, (@=?), (@?=)) import Test.Tasty.Hedgehog (testPropertyNamed) @@ -110,7 +111,7 @@ defaultBuiltinCostModelExt = (defaultBuiltinCostModelForTesting, ()) test_IntegerDistribution :: TestTree test_IntegerDistribution = - QC.testProperty "distribution of 'Integer' constants" . QC.withMaxSuccess 10000 $ + QC.testProperty "distribution of 'Integer' constants" . BaseQC.withNumTests 10000 $ \(AsArbitraryBuiltin (i :: Integer)) -> let magnitudes = magnitudesPositive nextInterestingBound highInterestingBound (low, high) = @@ -2017,7 +2018,7 @@ test_Case :: TestTree test_Case = testGroup "Case on constants" - [ QC.testProperty "Bool, 1 branch" . QC.withMaxSuccess 99 $ + [ QC.testProperty "Bool, 1 branch" . BaseQC.withNumTests 99 $ \(scrut :: Bool) (i :: Integer) -> let term :: TermLike term tyname name DefaultUni DefaultFun => term () term = @@ -2030,7 +2031,7 @@ test_Case = Right (EvaluationSuccess res) -> res == mkConstant () i Right EvaluationFailure -> scrut _ -> False - , QC.testProperty "Bool, 2 branches" . QC.withMaxSuccess 99 $ + , QC.testProperty "Bool, 2 branches" . BaseQC.withNumTests 99 $ \(scrut :: Bool) (i :: Integer) (j :: Integer) -> let term :: TermLike term tyname name DefaultUni DefaultFun => term () term = @@ -2041,7 +2042,7 @@ test_Case = [mkConstant () i, mkConstant () j] in Right (EvaluationSuccess . mkConstant () $ if not scrut then i else j) QC.=== typecheckEvaluateCekNoEmit def defaultBuiltinCostModelForTesting term - , QC.testProperty "Bool, 3+ branches" . QC.withMaxSuccess 99 $ + , QC.testProperty "Bool, 3+ branches" . BaseQC.withNumTests 99 $ \(scrut :: Bool) (is :: [Integer]) -> let term :: TermLike term tyname name DefaultUni DefaultFun => term () term = @@ -2051,7 +2052,7 @@ test_Case = (mkConstant () scrut) (map (mkConstant ()) $ [1, 2, 3] <> is) in isLeft $ typecheckEvaluateCekNoEmit def defaultBuiltinCostModelForTesting term - , QC.testProperty "Integer success" . QC.withMaxSuccess 99 $ + , QC.testProperty "Integer success" . BaseQC.withNumTests 99 $ \(QC.NonEmpty is :: QC.NonEmptyList Integer) -> QC.forAll (QC.chooseInt (0, length is - 1)) $ \scrut -> let term :: TermLike term tyname name DefaultUni DefaultFun => term () @@ -2063,7 +2064,7 @@ test_Case = (map (mkConstant ()) is) in Right (EvaluationSuccess . mkConstant () $ is !! scrut) QC.=== typecheckEvaluateCekNoEmit def defaultBuiltinCostModelForTesting term - , QC.testProperty "Integer any" . QC.withMaxSuccess 99 $ + , QC.testProperty "Integer any" . BaseQC.withNumTests 99 $ \(scrut :: Integer) (is :: [Integer]) -> let term :: TermLike term tyname name DefaultUni DefaultFun => term () term = @@ -2076,7 +2077,7 @@ test_Case = Left _ -> False Right EvaluationFailure -> 0 > scrut || scrut >= fromIntegral (length is) Right (EvaluationSuccess res) -> res == mkConstant () (is !! fromIntegral scrut) - , QC.testProperty "List, 1 branch" . QC.withMaxSuccess 99 $ + , QC.testProperty "List, 1 branch" . BaseQC.withNumTests 99 $ \(scrut :: [Integer]) -> let term :: Term TyName Name DefaultUni DefaultFun () @@ -2097,7 +2098,7 @@ test_Case = (Right (EvaluationSuccess res), (x : _)) -> res == mkConstant () x (Right EvaluationFailure, []) -> True _ -> False - , QC.testProperty "List, 2 branches" . QC.withMaxSuccess 99 $ + , QC.testProperty "List, 2 branches" . BaseQC.withNumTests 99 $ \(scrut :: [Integer]) (i :: Integer) -> let term :: Term TyName Name DefaultUni DefaultFun () @@ -2120,7 +2121,7 @@ test_Case = (Right (EvaluationSuccess res), []) -> res == mkConstant () i (Right (EvaluationSuccess res), (x : _)) -> res == mkConstant () x _ -> False - , QC.testProperty "List, 3+ branches" . QC.withMaxSuccess 99 $ + , QC.testProperty "List, 3+ branches" . BaseQC.withNumTests 99 $ \(scrut :: [Integer]) (is :: [Integer]) -> let term :: Term TyName Name DefaultUni DefaultFun () diff --git a/plutus-core/untyped-plutus-core/testlib/Evaluation/Builtins/Integer/DivModProperties.hs b/plutus-core/untyped-plutus-core/testlib/Evaluation/Builtins/Integer/DivModProperties.hs index 6d24ae58d90..23fa050e8f6 100644 --- a/plutus-core/untyped-plutus-core/testlib/Evaluation/Builtins/Integer/DivModProperties.hs +++ b/plutus-core/untyped-plutus-core/testlib/Evaluation/Builtins/Integer/DivModProperties.hs @@ -9,6 +9,7 @@ where import Evaluation.Builtins.Common import Evaluation.Builtins.Integer.Common +import Test.Cardano.Base.QuickCheck qualified as BaseQC import Test.Tasty (TestName, TestTree, testGroup) import Test.Tasty.QuickCheck @@ -16,7 +17,7 @@ numberOfTests :: Int numberOfTests = 200 testProp :: Testable prop => TestName -> prop -> TestTree -testProp s p = testProperty s $ withMaxSuccess numberOfTests p +testProp s p = testProperty s $ BaseQC.withNumTests numberOfTests p -- `divideInteger _ 0` always fails. prop_div_0_fails :: BigInteger -> Property diff --git a/plutus-core/untyped-plutus-core/testlib/Evaluation/Builtins/Integer/ExpModIntegerProperties.hs b/plutus-core/untyped-plutus-core/testlib/Evaluation/Builtins/Integer/ExpModIntegerProperties.hs index 17c6ec1fb6f..7c084cd602b 100644 --- a/plutus-core/untyped-plutus-core/testlib/Evaluation/Builtins/Integer/ExpModIntegerProperties.hs +++ b/plutus-core/untyped-plutus-core/testlib/Evaluation/Builtins/Integer/ExpModIntegerProperties.hs @@ -12,6 +12,7 @@ import Evaluation.Builtins.Integer.Common (arbitraryBigInteger) import PlutusCore qualified as PLC import PlutusCore.MkPlc (builtin, mkConstant, mkIterAppNoAnn) +import Test.Cardano.Base.QuickCheck qualified as BaseQC import Test.Tasty (TestName, TestTree, testGroup) import Test.Tasty.QuickCheck @@ -19,7 +20,7 @@ numberOfTests :: Int numberOfTests = 400 testProp :: Testable prop => TestName -> prop -> TestTree -testProp s p = testProperty s $ withMaxSuccess numberOfTests p +testProp s p = testProperty s $ BaseQC.withNumTests numberOfTests p expModInteger :: Integer -> Integer -> Integer -> PlcTerm expModInteger (integer -> a) (integer -> e) (integer -> m) = diff --git a/plutus-core/untyped-plutus-core/testlib/Evaluation/Builtins/Integer/OrderProperties.hs b/plutus-core/untyped-plutus-core/testlib/Evaluation/Builtins/Integer/OrderProperties.hs index 3ef794ff12d..032f61bf6b6 100644 --- a/plutus-core/untyped-plutus-core/testlib/Evaluation/Builtins/Integer/OrderProperties.hs +++ b/plutus-core/untyped-plutus-core/testlib/Evaluation/Builtins/Integer/OrderProperties.hs @@ -12,6 +12,7 @@ import Prelude hiding (and, not, or) import Evaluation.Builtins.Common import Evaluation.Builtins.Integer.Common +import Test.Cardano.Base.QuickCheck qualified as BaseQC import Test.Tasty (TestName, TestTree, testGroup) import Test.Tasty.QuickCheck @@ -19,7 +20,7 @@ numberOfTests :: Int numberOfTests = 200 testProp :: Testable prop => TestName -> prop -> TestTree -testProp s p = testProperty s $ withMaxSuccess numberOfTests p +testProp s p = testProperty s $ BaseQC.withNumTests numberOfTests p {- Tests for standard properties of order relations. In most of these we create totally random inputs and then create terms checking that the expected diff --git a/plutus-core/untyped-plutus-core/testlib/Evaluation/Builtins/Integer/QuotRemProperties.hs b/plutus-core/untyped-plutus-core/testlib/Evaluation/Builtins/Integer/QuotRemProperties.hs index 3c61f422efa..9ec9b572076 100644 --- a/plutus-core/untyped-plutus-core/testlib/Evaluation/Builtins/Integer/QuotRemProperties.hs +++ b/plutus-core/untyped-plutus-core/testlib/Evaluation/Builtins/Integer/QuotRemProperties.hs @@ -11,6 +11,7 @@ import Prelude hiding (abs) import Evaluation.Builtins.Common import Evaluation.Builtins.Integer.Common +import Test.Cardano.Base.QuickCheck qualified as BaseQC import Test.Tasty (TestName, TestTree, testGroup) import Test.Tasty.QuickCheck @@ -18,7 +19,7 @@ numberOfTests :: Int numberOfTests = 200 testProp :: Testable prop => TestName -> prop -> TestTree -testProp s p = testProperty s $ withMaxSuccess numberOfTests p +testProp s p = testProperty s $ BaseQC.withNumTests numberOfTests p -- `quotientInteger _ 0` always fails. prop_quot_0_fails :: BigInteger -> Property diff --git a/plutus-core/untyped-plutus-core/testlib/Flat/Spec.hs b/plutus-core/untyped-plutus-core/testlib/Flat/Spec.hs index ececa0ffef1..309b0244885 100644 --- a/plutus-core/untyped-plutus-core/testlib/Flat/Spec.hs +++ b/plutus-core/untyped-plutus-core/testlib/Flat/Spec.hs @@ -20,9 +20,10 @@ import PlutusCore.Flat import PlutusCore.Flat.Bits (asBytes, bits) import PlutusCore.Generators.QuickCheck.Builtin () import PlutusCore.Name.Unique (Name (..), TyName (..), Unique (..)) +import Test.Cardano.Base.QuickCheck qualified as BaseQC import Test.Tasty import Test.Tasty.HUnit -import Test.Tasty.QuickCheck +import Test.Tasty.QuickCheck hiding (Some) import Universe (Some (..), ValueOf (..)) import UntypedPlutusCore.Core.Type @@ -84,7 +85,7 @@ isCanonicalFlatEncodedByteString bs = test_canonicalEncoding :: forall a. (Arbitrary a, Flat a, Show a) => String -> Int -> TestTree test_canonicalEncoding s n = testProperty s $ - withMaxSuccess n $ + BaseQC.withNumTests n $ forAll (arbitrary @a) (isCanonicalFlatEncodedByteString . flat @a) -- Data objects are encoded by first being converted to a bytestring using CBOR. @@ -342,10 +343,10 @@ test_nonCanonicalByteStringDecoding = in testGroup "Non-canonical bytestring encodings decode succesfully" [ testProperty "Data via lazy bytestrings" $ - withMaxSuccess 5000 $ forAll (arbitrary @Data) \d -> + BaseQC.withNumTests 5000 $ forAll (arbitrary @Data) \d -> Right d === unflat (flat (serialise d :: BSL.ByteString)) , testProperty "Arbitrary lazy bytestrings" $ - withMaxSuccess 10000 $ + BaseQC.withNumTests 10000 $ forAll (arbitrary @BSL.ByteString) \bs -> Right (BSL.toStrict bs) === unflat (flat bs) , testCase "Explicit input 1" $ mkTest input1 diff --git a/plutus-executables/plutus-executables.cabal b/plutus-executables/plutus-executables.cabal index 559dc1472fb..50240ae01b6 100644 --- a/plutus-executables/plutus-executables.cabal +++ b/plutus-executables/plutus-executables.cabal @@ -179,8 +179,8 @@ executable plutus , singletons-th , text , text-zipper - , vty ^>=6.5 - , vty-crossplatform ^>=0.4 + , vty ^>=6.6 + , vty-crossplatform ^>=0.5 ghc-options: -O2 -threaded -rtsopts -with-rtsopts=-N default-extensions: diff --git a/plutus-ledger-api/plutus-ledger-api.cabal b/plutus-ledger-api/plutus-ledger-api.cabal index c2d9e15a342..413f6e6517d 100644 --- a/plutus-ledger-api/plutus-ledger-api.cabal +++ b/plutus-ledger-api/plutus-ledger-api.cabal @@ -107,7 +107,7 @@ library Prettyprinter.Extras build-depends: - , aeson + , aeson >=2.3 , aeson-pretty , base >=4.9 && <5 , base16-bytestring >=1 @@ -139,7 +139,7 @@ library plutus-execlib PlutusCore.Executable.Types build-depends: - , aeson + , aeson >=2.3 , aeson-pretty , base >=4.9 && <5 , base16-bytestring ^>=1.0 @@ -230,6 +230,7 @@ test-suite plutus-ledger-api-test build-depends: , base >=4.9 && <5 , bytestring + , cardano-base:testlib >=0.1.5 , cborg , containers , extra @@ -336,7 +337,7 @@ executable dump-cost-model-parameters default-language: Haskell2010 ghc-options: -threaded -rtsopts -with-rtsopts=-N build-depends: - , aeson + , aeson >=2.3 , aeson-pretty , base >=4.9 && <5 , bytestring diff --git a/plutus-ledger-api/test/Spec/V1/Data/Value.hs b/plutus-ledger-api/test/Spec/V1/Data/Value.hs index 1f807062d6f..47430db98a5 100644 --- a/plutus-ledger-api/test/Spec/V1/Data/Value.hs +++ b/plutus-ledger-api/test/Spec/V1/Data/Value.hs @@ -9,6 +9,7 @@ import PlutusTx.Numeric qualified as Numeric import Control.Lens import Data.ByteString qualified as BS import Data.List (sort) +import Test.Cardano.Base.QuickCheck qualified as BaseQC import Test.Tasty import Test.Tasty.HUnit (testCase, (@?=)) import Test.Tasty.QuickCheck @@ -26,7 +27,7 @@ x <=> y = x === y .&&. y === x x y = x =/= y .&&. y =/= x scaleTestsBy :: Testable prop => Int -> prop -> Property -scaleTestsBy factor = withMaxSuccess (100 * factor) . mapSize (* factor) +scaleTestsBy factor = BaseQC.withNumTests (100 * factor) . mapSize (* factor) {-| Apply a function to an arbitrary number of elements of the given list. The elements are chosen at random. -} diff --git a/plutus-ledger-api/test/Spec/V1/Value.hs b/plutus-ledger-api/test/Spec/V1/Value.hs index e53e6127f8e..372f0125f80 100644 --- a/plutus-ledger-api/test/Spec/V1/Value.hs +++ b/plutus-ledger-api/test/Spec/V1/Value.hs @@ -10,6 +10,7 @@ import PlutusTx.Numeric qualified as Numeric import Control.Lens import Data.ByteString qualified as BS import Data.List (sort) +import Test.Cardano.Base.QuickCheck qualified as BaseQC import Test.Tasty import Test.Tasty.HUnit (testCase, (@?=)) import Test.Tasty.QuickCheck @@ -27,7 +28,7 @@ x <=> y = x === y .&&. y === x x y = x =/= y .&&. y =/= x scaleTestsBy :: Testable prop => Int -> prop -> Property -scaleTestsBy factor = withMaxSuccess (100 * factor) . mapSize (* factor) +scaleTestsBy factor = BaseQC.withNumTests (100 * factor) . mapSize (* factor) {-| Apply a function to an arbitrary number of elements of the given list. The elements are chosen at random. -} diff --git a/plutus-tx-plugin/plutus-tx-plugin.cabal b/plutus-tx-plugin/plutus-tx-plugin.cabal index ab359f994da..d17025d0bde 100644 --- a/plutus-tx-plugin/plutus-tx-plugin.cabal +++ b/plutus-tx-plugin/plutus-tx-plugin.cabal @@ -288,6 +288,7 @@ test-suite plutus-ledger-api-plugin-test build-depends: , base >=4.9 && <5 , bytestring + , cardano-base:testlib >=0.1.5 , containers , filepath , lens diff --git a/plutus-tx-plugin/test-ledger-api/Spec/Data/MintValue/V3.hs b/plutus-tx-plugin/test-ledger-api/Spec/Data/MintValue/V3.hs index b88789e6eeb..02b0c8f9cf7 100644 --- a/plutus-tx-plugin/test-ledger-api/Spec/Data/MintValue/V3.hs +++ b/plutus-tx-plugin/test-ledger-api/Spec/Data/MintValue/V3.hs @@ -28,6 +28,7 @@ import PlutusTx.Data.List qualified as List import PlutusTx.Lift (liftCodeDef) import PlutusTx.TH (compile) import PlutusTx.Test.Run.Code (evaluationResultMatchesHaskell) +import Test.Cardano.Base.QuickCheck qualified as BaseQC import Test.QuickCheck qualified as QC import Test.Tasty (TestTree, testGroup) import Test.Tasty.QuickCheck (Property, testProperty, (===)) @@ -145,7 +146,7 @@ test_Plinth_MintValueBurnedIsPositive = scaleTestsBy :: QC.Testable prop => Haskell.Int -> prop -> QC.Property scaleTestsBy factor = - QC.withMaxSuccess (100 Haskell.* factor) . QC.mapSize (Haskell.* factor) + BaseQC.withNumTests (100 Haskell.* factor) . QC.mapSize (Haskell.* factor) cekProp :: CompiledCode Bool -> Property cekProp code = evaluationResultMatchesHaskell code (===) True diff --git a/plutus-tx-plugin/test-ledger-api/Spec/MintValue/V3.hs b/plutus-tx-plugin/test-ledger-api/Spec/MintValue/V3.hs index 6246f029568..9a9e427019d 100644 --- a/plutus-tx-plugin/test-ledger-api/Spec/MintValue/V3.hs +++ b/plutus-tx-plugin/test-ledger-api/Spec/MintValue/V3.hs @@ -28,6 +28,7 @@ import PlutusTx.Lift (liftCodeDef) import PlutusTx.List qualified as List import PlutusTx.TH (compile) import PlutusTx.Test.Run.Code (evaluationResultMatchesHaskell) +import Test.Cardano.Base.QuickCheck qualified as BaseQC import Test.QuickCheck qualified as QC import Test.Tasty (TestTree, testGroup) import Test.Tasty.QuickCheck (Property, testProperty, (===)) @@ -145,7 +146,7 @@ test_Plinth_MintValueBurnedIsPositive = scaleTestsBy :: QC.Testable prop => Haskell.Int -> prop -> QC.Property scaleTestsBy factor = - QC.withMaxSuccess (100 Haskell.* factor) . QC.mapSize (Haskell.* factor) + BaseQC.withNumTests (100 Haskell.* factor) . QC.mapSize (Haskell.* factor) cekProp :: CompiledCode Bool -> Property cekProp code = evaluationResultMatchesHaskell code (===) True diff --git a/plutus-tx-plugin/test-ledger-api/Spec/Value/WithCurrencySymbol.hs b/plutus-tx-plugin/test-ledger-api/Spec/Value/WithCurrencySymbol.hs index 5a7c793f0ac..fa7ae2a5d5d 100644 --- a/plutus-tx-plugin/test-ledger-api/Spec/Value/WithCurrencySymbol.hs +++ b/plutus-tx-plugin/test-ledger-api/Spec/Value/WithCurrencySymbol.hs @@ -39,6 +39,7 @@ import PlutusTx.Lift (liftCodeDef) import PlutusTx.List qualified as List import PlutusTx.TH (compile) import PlutusTx.Test.Run.Code (evaluationResultMatchesHaskell) +import Test.Cardano.Base.QuickCheck qualified as BaseQC import Test.QuickCheck import Test.Tasty (TestTree, testGroup) import Test.Tasty.QuickCheck (testProperty) @@ -112,7 +113,7 @@ test_Plinth_CorrectTokenQuantitiesAreSelected = scaleTestsBy :: Testable prop => Haskell.Int -> prop -> Property scaleTestsBy factor = - withMaxSuccess (100 Haskell.* factor) . mapSize (Haskell.* factor) + BaseQC.withNumTests (100 Haskell.* factor) . mapSize (Haskell.* factor) cekProp :: CompiledCode Bool -> Property cekProp code = evaluationResultMatchesHaskell code (===) True diff --git a/plutus-tx/plutus-tx.cabal b/plutus-tx/plutus-tx.cabal index 0790dae4381..442fddab610 100644 --- a/plutus-tx/plutus-tx.cabal +++ b/plutus-tx/plutus-tx.cabal @@ -136,7 +136,7 @@ library PlutusTx.Ord.TH build-depends: - , aeson >=2.2 + , aeson >=2.3 , aeson-pretty , base >=4.9 && <5 , base16-bytestring