Skip to content

Commit

Permalink
add roundtrip test for ToText/FromText DerivationPrefix instances
Browse files Browse the repository at this point in the history
  • Loading branch information
KtorZ committed Oct 8, 2020
1 parent 6f98771 commit 7e4a6a4
Showing 1 changed file with 15 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ import Cardano.Wallet.Primitive.AddressDerivation
( AccountingStyle (..)
, DelegationAddress (..)
, Depth (..)
, DerivationType (..)
, HardDerivation (..)
, Index
, KeyFingerprint
, MkKeyFingerprint (..)
, NetworkDiscriminant (..)
Expand Down Expand Up @@ -103,7 +105,6 @@ import Test.QuickCheck
, Positive (..)
, Property
, arbitraryBoundedEnum
, arbitraryBoundedEnum
, checkCoverage
, choose
, classify
Expand Down Expand Up @@ -144,6 +145,9 @@ spec = do
it "defaultAddressPoolGap is valid"
(property prop_defaultValid)

describe "DerivationPrefix" $ do
textRoundtrip (Proxy @DerivationPrefix)

let styles =
[ Style (Proxy @'UTxOExternal)
, Style (Proxy @'UTxOInternal)
Expand Down Expand Up @@ -640,6 +644,16 @@ instance Arbitrary AddressState where
shrink _ = []
arbitrary = genericArbitrary

instance Arbitrary DerivationPrefix where
arbitrary = fmap DerivationPrefix $ (,,)
<$> arbitrary
<*> arbitrary
<*> arbitrary

instance Arbitrary (Index 'Hardened depth) where
shrink _ = []
arbitrary = arbitraryBoundedEnum

-- | In this context, Arbitrary addresses are either some known addresses
-- derived from "our account key", or they just are some arbitrary addresses
-- that are unknown to us.
Expand Down

0 comments on commit 7e4a6a4

Please sign in to comment.