Skip to content

Commit 8a4a4a3

Browse files
committed
Use patterns to define deltas in delegation ModelSpec
1 parent 765222e commit 8a4a4a3

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

lib/unit/test/unit/Cardano/Wallet/Delegation/ModelSpec.hs

+9-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{-# LANGUAGE ConstraintKinds #-}
22
{-# LANGUAGE FlexibleContexts #-}
33
{-# LANGUAGE MonoLocalBinds #-}
4+
{-# LANGUAGE PatternSynonyms #-}
45
{-# LANGUAGE ScopedTypeVariables #-}
56
{-# LANGUAGE TypeApplications #-}
67

@@ -22,7 +23,10 @@ import Cardano.Wallet.Delegation.Model
2223
( History
2324
, Operation (..)
2425
, Status (Active)
25-
, Transition (..)
26+
, pattern Delegate
27+
, pattern DelegateAndVote
28+
, pattern Deregister'
29+
, pattern Vote
2630
)
2731
import Cardano.Wallet.Delegation.Properties
2832
( Step (Step)
@@ -90,10 +94,10 @@ genDelta c h = do
9094
pool <- genPool c h
9195
drep <- genRep c h
9296
elements
93-
[ ApplyTransition (VoteAndDelegate (Just drep) (Just pool)) slot
94-
, ApplyTransition (VoteAndDelegate Nothing (Just pool)) slot
95-
, ApplyTransition (VoteAndDelegate (Just drep) Nothing) slot
96-
, ApplyTransition Deregister slot
97+
[ DelegateAndVote pool drep slot
98+
, Delegate pool slot
99+
, Vote drep slot
100+
, Deregister' slot
97101
, Rollback slot
98102
]
99103

0 commit comments

Comments
 (0)