-- * Arbitrary instances
-instance Arbitrary OpCodes.ReplaceDisksMode where
- arbitrary = elements [minBound..maxBound]
+$(genArbitrary ''OpCodes.ReplaceDisksMode)
instance Arbitrary OpCodes.DiskIndex where
arbitrary = choose (0, C.maxDisks - 1) >>= OpCodes.mkDiskIndex
-- | Check that opcode serialization is idempotent.
prop_serialization :: OpCodes.OpCode -> Property
-prop_serialization op =
- case J.readJSON (J.showJSON op) of
- J.Error e -> failTest $ "Cannot deserialise: " ++ e
- J.Ok op' -> op ==? op'
+prop_serialization = testSerialisation
-- | Check that Python and Haskell defined the same opcode list.
case_AllDefined :: HUnit.Assertion