X-Git-Url: https://code.grnet.gr/git/ganeti-local/blobdiff_plain/20bc53603bf22a5242c70f12b0ea209e353cd87d..90171729fffaa2d1d1846f2216100373356fec5d:/htest/Test/Ganeti/OpCodes.hs diff --git a/htest/Test/Ganeti/OpCodes.hs b/htest/Test/Ganeti/OpCodes.hs index d184d21..93abaf1 100644 --- a/htest/Test/Ganeti/OpCodes.hs +++ b/htest/Test/Ganeti/OpCodes.hs @@ -46,8 +46,7 @@ import qualified Ganeti.OpCodes as OpCodes -- * 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 @@ -74,10 +73,7 @@ instance Arbitrary OpCodes.OpCode where -- | 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