Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix shrinker for ProtocolParameters. #3205

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 16 additions & 12 deletions lib/core/test/unit/Cardano/Wallet/DB/Arbitrary.hs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
{-# LANGUAGE NumericUnderscores #-}
{-# LANGUAGE OverloadedLabels #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE TypeApplications #-}
Expand Down Expand Up @@ -174,6 +173,8 @@ import Data.Word.Odd
( Word31 )
import Fmt
( Buildable (..), Builder, blockListF', prefixF, suffixF, tupleF )
import Generics.SOP
( NP (..) )
import GHC.Generics
( Generic )
import Numeric.Natural
Expand Down Expand Up @@ -205,6 +206,8 @@ import Test.QuickCheck
)
import Test.QuickCheck.Arbitrary.Generic
( genericArbitrary )
import Test.QuickCheck.Extra
( genericRoundRobinShrink, (<:>), (<@>) )
import Test.Utils.Time
( genUniformTime )

Expand Down Expand Up @@ -665,17 +668,18 @@ arbitrarySharedAccount =
-------------------------------------------------------------------------------}

instance Arbitrary ProtocolParameters where
shrink ProtocolParameters {..} = ProtocolParameters
<$> shrink decentralizationLevel
<*> shrink txParameters
<*> shrink desiredNumberOfStakePools
<*> shrink minimumUTxOvalue
<*> shrink stakeKeyDeposit
<*> shrink eras
<*> shrink maximumCollateralInputCount
<*> shrink minimumCollateralPercentage
<*> shrink executionUnitPrices
<*> pure Nothing
shrink = genericRoundRobinShrink
<@> shrink
<:> shrink
<:> shrink
<:> shrink
<:> shrink
<:> shrink
<:> shrink
<:> shrink
<:> shrink
<:> const []
<:> Nil
arbitrary = ProtocolParameters
<$> arbitrary
<*> arbitrary
Expand Down