diff --git a/lib/core/test/unit/Cardano/Wallet/Primitive/CoinSelection/MA/RoundRobinSpec.hs b/lib/core/test/unit/Cardano/Wallet/Primitive/CoinSelection/MA/RoundRobinSpec.hs index 851ce593aff..72309842e17 100644 --- a/lib/core/test/unit/Cardano/Wallet/Primitive/CoinSelection/MA/RoundRobinSpec.hs +++ b/lib/core/test/unit/Cardano/Wallet/Primitive/CoinSelection/MA/RoundRobinSpec.hs @@ -501,11 +501,11 @@ prop_AssetCount_TokenMap_placesEmptyMapsFirst maps = $ cover 20 (emptyMapCount >= 8 && nonEmptyMapCount >= 8) "empty map count >= 8 && non-empty map count >= 8" -- Check head and last element of list: - $ cover 40 (isEmptyMap $ NE.head maps) + $ cover 20 (isEmptyMap $ NE.head maps) "head element is empty map" $ cover 40 (not $ isEmptyMap $ NE.head maps) "head element is non-empty map" - $ cover 40 (isEmptyMap $ NE.last maps) + $ cover 20 (isEmptyMap $ NE.last maps) "last element is empty map" $ cover 40 (not $ isEmptyMap $ NE.last maps) "last element is non-empty map" @@ -738,7 +738,7 @@ prop_performSelection_small minCoinValueFor costFor (Blind (Small criteria)) = prop_performSelection minCoinValueFor costFor (Blind criteria) $ \result -> cover 10 (selectionUnlimited && selectionSufficient result) "selection unlimited and sufficient" - . cover 5 (selectionLimited && selectionSufficient result) + . cover 4 (selectionLimited && selectionSufficient result) "selection limited but sufficient" . cover 10 (selectionLimited && selectionInsufficient result) "selection limited and insufficient" diff --git a/lib/core/test/unit/Cardano/Wallet/Primitive/Types/TokenMapSpec.hs b/lib/core/test/unit/Cardano/Wallet/Primitive/Types/TokenMapSpec.hs index 0c497163bb4..8ed0f6fef86 100644 --- a/lib/core/test/unit/Cardano/Wallet/Primitive/Types/TokenMapSpec.hs +++ b/lib/core/test/unit/Cardano/Wallet/Primitive/Types/TokenMapSpec.hs @@ -773,9 +773,9 @@ prop_equipartitionQuantitiesWithUpperBound_coverage :: TokenMap -> Positive TokenQuantity -> Property prop_equipartitionQuantitiesWithUpperBound_coverage m (Positive maxQuantity) = checkCoverage $ - cover 8 (maxQuantity == TokenQuantity 1) + cover 4 (maxQuantity == TokenQuantity 1) "Maximum allowable quantity == 1" $ - cover 8 (maxQuantity == TokenQuantity 2) + cover 4 (maxQuantity == TokenQuantity 2) "Maximum allowable quantity == 2" $ cover 8 (maxQuantity >= TokenQuantity 3) "Maximum allowable quantity >= 3" $ diff --git a/lib/core/test/unit/Cardano/Wallet/Primitive/Types/UTxOIndexSpec.hs b/lib/core/test/unit/Cardano/Wallet/Primitive/Types/UTxOIndexSpec.hs index 2eb6a8f0246..91758ee1ca0 100644 --- a/lib/core/test/unit/Cardano/Wallet/Primitive/Types/UTxOIndexSpec.hs +++ b/lib/core/test/unit/Cardano/Wallet/Primitive/Types/UTxOIndexSpec.hs @@ -433,11 +433,11 @@ prop_selectRandom_one_withAdaOnly u = checkCoverage $ monadicIO $ do prop_selectRandom_one_withAsset :: UTxOIndex -> AssetId -> Property prop_selectRandom_one_withAsset u a = checkCoverage $ monadicIO $ do result <- run $ UTxOIndex.selectRandom u (WithAsset a) - monitor $ cover 70 (a `Set.member` UTxOIndex.assets u) + monitor $ cover 50 (a `Set.member` UTxOIndex.assets u) "index has the specified asset" - monitor $ cover 70 (Set.size (UTxOIndex.assets u) > 1) + monitor $ cover 50 (Set.size (UTxOIndex.assets u) > 1) "index has more than one asset" - monitor $ cover 70 (isJust result) + monitor $ cover 50 (isJust result) "selected an entry" case result of Nothing -> @@ -459,11 +459,11 @@ prop_selectRandom_one_withAsset u a = checkCoverage $ monadicIO $ do prop_selectRandom_one_withAssetOnly :: UTxOIndex -> AssetId -> Property prop_selectRandom_one_withAssetOnly u a = checkCoverage $ monadicIO $ do result <- run $ UTxOIndex.selectRandom u (WithAssetOnly a) - monitor $ cover 70 (a `Set.member` UTxOIndex.assets u) + monitor $ cover 50 (a `Set.member` UTxOIndex.assets u) "index has the specified asset" - monitor $ cover 70 (Set.size (UTxOIndex.assets u) > 1) + monitor $ cover 50 (Set.size (UTxOIndex.assets u) > 1) "index has more than one asset" - monitor $ cover 20 (isJust result) + monitor $ cover 10 (isJust result) "selected an entry" case result of Nothing -> @@ -509,11 +509,11 @@ prop_selectRandom_all_withAdaOnly u = checkCoverage $ monadicIO $ do prop_selectRandom_all_withAsset :: UTxOIndex -> AssetId -> Property prop_selectRandom_all_withAsset u a = checkCoverage $ monadicIO $ do (selectedEntries, u') <- run $ selectAll (WithAsset a) u - monitor $ cover 70 (a `Set.member` UTxOIndex.assets u) + monitor $ cover 50 (a `Set.member` UTxOIndex.assets u) "index has the specified asset" - monitor $ cover 70 (Set.size (UTxOIndex.assets u) > 1) + monitor $ cover 50 (Set.size (UTxOIndex.assets u) > 1) "index has more than one asset" - monitor $ cover 70 (not (null selectedEntries)) + monitor $ cover 50 (not (null selectedEntries)) "selected at least one entry" assert $ L.all (\(_, o) -> not (txOutHasAsset o a)) (UTxOIndex.toList u') assert $ L.all (\(_, o) -> txOutHasAsset o a) selectedEntries @@ -526,11 +526,11 @@ prop_selectRandom_all_withAsset u a = checkCoverage $ monadicIO $ do prop_selectRandom_all_withAssetOnly :: UTxOIndex -> AssetId -> Property prop_selectRandom_all_withAssetOnly u a = checkCoverage $ monadicIO $ do (selectedEntries, u') <- run $ selectAll (WithAssetOnly a) u - monitor $ cover 70 (a `Set.member` UTxOIndex.assets u) + monitor $ cover 50 (a `Set.member` UTxOIndex.assets u) "index has the specified asset" - monitor $ cover 70 (Set.size (UTxOIndex.assets u) > 1) + monitor $ cover 50 (Set.size (UTxOIndex.assets u) > 1) "index has more than one asset" - monitor $ cover 20 (not (null selectedEntries)) + monitor $ cover 10 (not (null selectedEntries)) "selected at least one entry" assert $ all (\(_, o) -> not (txOutHasAssetOnly o a)) (UTxOIndex.toList u') assert $ all (\(_, o) -> txOutHasAssetOnly o a) selectedEntries diff --git a/lib/core/test/unit/Cardano/Wallet/Primitive/TypesSpec.hs b/lib/core/test/unit/Cardano/Wallet/Primitive/TypesSpec.hs index 63ee7902611..da27ac504f1 100644 --- a/lib/core/test/unit/Cardano/Wallet/Primitive/TypesSpec.hs +++ b/lib/core/test/unit/Cardano/Wallet/Primitive/TypesSpec.hs @@ -1149,7 +1149,9 @@ instance Arbitrary TxOut where -- No Shrinking arbitrary = TxOut <$> arbitrary - <*> fmap TokenBundle.fromCoin genCoin + -- Here we deliberately restrict the range of coins in order to increase + -- the probability of collisions between identical transaction outputs: + <*> fmap TokenBundle.fromCoin (scale (`mod` 8) genCoin) instance Arbitrary TxIn where -- No Shrinking