1- {-# LANGUAGE CPP #-}
21{-# LANGUAGE TypeApplications #-}
32
43module Generators.QuickCheck.Utils where
@@ -9,8 +8,6 @@ import PlutusCore.Data
98import PlutusCore.Generators.QuickCheck.Builtin
109import PlutusCore.Generators.QuickCheck.Utils
1110
12- import qualified Test.QuickCheck as QC
13-
1411import Test.Tasty
1512import Test.Tasty.QuickCheck
1613
@@ -24,14 +21,14 @@ test_multiSplitSound =
2421 , (" multiSplit0" , multiSplit0 0.1 )
2522 ]
2623 pure . testProperty name $ \ (xs :: [Int ]) ->
27- withNumTests 10000 . forAll (split xs) $ \ aSplit ->
24+ withMaxSuccess 10000 . forAll (split xs) $ \ aSplit ->
2825 xs === concat aSplit
2926
3027-- | Show the distribution of lists generated by a split function for a list of the given length.
3128test_listDistribution :: Int -> ([() ] -> Gen [[() ]]) -> Int -> TestTree
3229test_listDistribution numRuns split n =
3330 testProperty (" for a list of length " ++ show n) $
34- withNumTests numRuns . forAll (split $ replicate n () ) $ \ aSplit ->
31+ withMaxSuccess numRuns . forAll (split $ replicate n () ) $ \ aSplit ->
3532 label (show $ map length aSplit) True
3633
3734-- | Count the number of 'I' and 'B' nodes in a 'Data' object.
@@ -51,7 +48,7 @@ length of the spine. Ensures that the 'Data' generator is not exponential in 'B'
5148test_arbitraryDataExpectedLeafs :: TestTree
5249test_arbitraryDataExpectedLeafs =
5350 testProperty " 'arbitrary @Data' has the expected number of 'B' and 'I' leaves" $
54- withNumTests 1000 . mapSize (* 5 ) $ \ spine ->
51+ withMaxSuccess 1000 . mapSize (* 5 ) $ \ spine ->
5552 forAll (genDataFromSpine spine) $ \ dat ->
5653 countIandBs dat === length spine
5754
@@ -83,10 +80,3 @@ test_utils =
8380 , test_multiSplitSound
8481 , test_multiSplitDistribution
8582 ]
86-
87- withNumTests :: QC. Testable prop => Int -> prop -> QC. Property
88- #if MIN_VERSION_QuickCheck(2, 18, 0)
89- withNumTests = QC. withNumTests
90- #else
91- withNumTests = QC. withMaxSuccess
92- #endif
0 commit comments