Skip to content

Commit

Permalink
Increase the chance of generating empty or singleton token maps.
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathanknowles committed Jan 13, 2021
1 parent b946655 commit 8280023
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/core/src/Cardano/Wallet/Primitive/Types/TokenMap/Gen.hs
Expand Up @@ -20,7 +20,7 @@ import Cardano.Wallet.Primitive.Types.TokenQuantity.Gen
import Control.Monad
( replicateM )
import Test.QuickCheck
( Gen, choose, shrinkList )
( Gen, choose, oneof, shrinkList )
import Test.QuickCheck.Extra
( shrinkInterleaved )

Expand All @@ -46,7 +46,11 @@ shrinkAssetIdSmallRange (AssetId p t) = uncurry AssetId <$> shrinkInterleaved

genTokenMapSmallRange :: Gen TokenMap
genTokenMapSmallRange = do
assetCount <- choose (0, 16)
assetCount <- oneof
[ pure 0
, pure 1
, choose (2, 16)
]
TokenMap.fromFlatList <$> replicateM assetCount genAssetQuantity
where
genAssetQuantity = (,)
Expand Down

0 comments on commit 8280023

Please sign in to comment.