@@ -9,10 +9,10 @@ import Prelude
9
9
import Data.List ((\\) )
10
10
import Data.Map.Strict (Map )
11
11
import qualified Data.Map.Strict as Map
12
- import Test.Hspec (describe )
12
+ import Test.Hspec (SpecWith , describe )
13
13
import Test.Hspec.QuickCheck (prop )
14
14
import Test.QuickCheck (Gen , Property , elements , forAllShrink ,
15
- ioProperty , listOf , shrinkList , sized , (===) )
15
+ ioProperty , shrinkList , sized , (===) )
16
16
17
17
import Pos.Infra.Diffusion.Subscription.Status (Changes ,
18
18
SubscriptionStates , SubscriptionStatus (.. ), changes ,
@@ -27,9 +27,7 @@ newtype Inputs = Inputs
27
27
}
28
28
deriving (Show )
29
29
30
- newtype Expectations = Expectations
31
- { getExpectations :: [Map Key SubscriptionStatus ]
32
- }
30
+ newtype Expectations = Expectations [Map Key SubscriptionStatus ]
33
31
deriving (Eq , Show )
34
32
35
33
type Observations = Expectations
@@ -92,9 +90,9 @@ getObservations (Inputs inputs) = do
92
90
-> Changes Key
93
91
-> IO Observations
94
92
start [] _ _ = pure (Expectations [] )
95
- start (initial : rest) states changes = do
93
+ start (initial : rest) states changes' = do
96
94
feedInput initial states
97
- (_, observed) <- withChanges changes step (rest, states, [] )
95
+ (_, observed) <- withChanges changes' step (rest, states, [] )
98
96
pure (Expectations (reverse observed))
99
97
100
98
step
@@ -103,7 +101,7 @@ getObservations (Inputs inputs) = do
103
101
-> IO ( Either ([(Key , Maybe SubscriptionStatus )], SubscriptionStates Key , [Map Key SubscriptionStatus ])
104
102
[Map Key SubscriptionStatus ]
105
103
)
106
- step ([] , states , observed) m = pure (Right (m : observed))
104
+ step ([] , _ , observed) m = pure (Right (m : observed))
107
105
step ((input : rest), states, observed) m = do
108
106
feedInput input states
109
107
pure (Left (rest, states, m : observed))
@@ -114,4 +112,5 @@ getObservations (Inputs inputs) = do
114
112
Just Subscribing -> subscribing states key
115
113
Just Subscribed -> subscribed states key
116
114
115
+ spec :: SpecWith ()
117
116
spec = describe " Status" $ prop " state change consistency" property
0 commit comments