Skip to content

Commit

Permalink
Fix Arbitrary instance for HydraMessage
Browse files Browse the repository at this point in the history
  • Loading branch information
ch1bo committed Jun 8, 2021
1 parent e82e1e8 commit d912a80
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions hydra-node/test/Hydra/NetworkSpec.hs
Expand Up @@ -17,7 +17,7 @@ import Hydra.Logging (nullTracer)
import Hydra.Network.Ouroboros (broadcast, withOuroborosHydraNetwork)
import Hydra.Network.ZeroMQ (withZeroMQHydraNetwork)
import Test.Hspec (Spec, describe, expectationFailure, it, pendingWith, shouldReturn)
import Test.QuickCheck (Arbitrary (..), arbitrary, oneof, property)
import Test.QuickCheck (Arbitrary (..), Positive (getPositive), arbitrary, oneof, property)

type MockTx = ()

Expand Down Expand Up @@ -99,12 +99,14 @@ instance Arbitrary (HydraMessage Integer) where
arbitrary =
oneof
[ ReqTx <$> arbitrary
, AckTx <$> fmap (fromIntegral @Int) arbitrary <*> arbitrary
, AckTx <$> arbitraryNatural <*> arbitrary
, pure ConfTx
, pure ReqSn
, pure AckSn
, pure ConfSn
]
where
arbitraryNatural = fromIntegral . getPositive <$> arbitrary @(Positive Integer)

prop_canRoundtripSerialise :: (Serialise a, Eq a) => a -> Bool
prop_canRoundtripSerialise a =
Expand Down

0 comments on commit d912a80

Please sign in to comment.