Skip to content
Permalink
Browse files

Add status generator that preclude Quantity 100

  • Loading branch information...
paweljakubas committed May 16, 2019
1 parent 7d75291 commit 1ef05252495d7d76a84c7a97debea72d8501e279
Showing with 8 additions and 2 deletions.
  1. +8 −2 lib/core/test/unit/Cardano/Wallet/DBSpec.hs
@@ -71,7 +71,7 @@ import Data.Functor.Identity
import Data.Map.Strict
( Map )
import Data.Quantity
( Quantity (..) )
( Percentage, Quantity (..), mkPercentage )
import Data.Word
( Word32 )
import GHC.Generics
@@ -95,6 +95,7 @@ import Test.QuickCheck
, oneof
, property
, scale
, suchThat
, vectorOf
)
import Test.QuickCheck.Instances.Time
@@ -174,12 +175,17 @@ instance Arbitrary TxMeta where
<*> (SlotId <$> arbitrary <*> choose (0, 21600))
<*> fmap (Quantity . fromIntegral) (arbitrary @Word32)

customizedGen :: Gen Percentage
customizedGen = do
let (Right upperBound) = mkPercentage @Int 100
arbitraryBoundedEnum `suchThat` (/= upperBound)

instance Arbitrary WalletMetadata where
shrink _ = []
arbitrary = WalletMetadata
<$> (WalletName <$> elements ["bulbazaur", "charmander", "squirtle"])
<*> (fmap WalletPassphraseInfo <$> arbitrary)
<*> oneof [pure Ready, Restoring . Quantity <$> arbitraryBoundedEnum]
<*> oneof [pure Ready, Restoring . Quantity <$> customizedGen]
<*> pure NotDelegating

instance Arbitrary Address where

0 comments on commit 1ef0525

Please sign in to comment.
You can’t perform that action at this time.