Skip to content

Commit d71d649

Browse files
committed
QC
1 parent d1bd436 commit d71d649

1 file changed

Lines changed: 3 additions & 13 deletions

File tree

  • plutus-core/plutus-core/test/Generators/QuickCheck

plutus-core/plutus-core/test/Generators/QuickCheck/Utils.hs

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
{-# LANGUAGE CPP #-}
21
{-# LANGUAGE TypeApplications #-}
32

43
module Generators.QuickCheck.Utils where
@@ -9,8 +8,6 @@ import PlutusCore.Data
98
import PlutusCore.Generators.QuickCheck.Builtin
109
import PlutusCore.Generators.QuickCheck.Utils
1110

12-
import qualified Test.QuickCheck as QC
13-
1411
import Test.Tasty
1512
import 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.
3128
test_listDistribution :: Int -> ([()] -> Gen [[()]]) -> Int -> TestTree
3229
test_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'
5148
test_arbitraryDataExpectedLeafs :: TestTree
5249
test_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

Comments
 (0)