Commit c211dcc4 authored by Petr Pudlak's avatar Petr Pudlak
Browse files

Add tests for (de)serialization of ClientId



.. to test if `readJSON . showJSON = Ok`.
Signed-off-by: default avatarPetr Pudlak <pudlak@google.com>
Reviewed-by: default avatarHelga Velroyen <helgav@google.com>
parent 3addd59f
......@@ -28,13 +28,14 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
module Test.Ganeti.Locking.Locks (testLocking_Locks) where
import Control.Applicative ((<$>), liftA2)
import Control.Applicative ((<$>), (<*>), liftA2)
import Test.QuickCheck
import Text.JSON
import Test.Ganeti.TestHelper
import Test.Ganeti.TestCommon
import Test.Ganeti.Types ()
import Ganeti.Locking.Locks
import Ganeti.Locking.Types
......@@ -89,9 +90,18 @@ prop_ReadShowLevel :: Property
prop_ReadShowLevel = forAll (arbitrary :: Gen LockLevel) $ \a ->
readJSON (showJSON a) ==? Ok a
instance Arbitrary ClientId where
arbitrary = ClientId <$> arbitrary <*> arbitrary <*> arbitrary
-- | Verify that readJSON . showJSON = Ok for ClientId
prop_ReadShow_ClientId :: Property
prop_ReadShow_ClientId = forAll (arbitrary :: Gen ClientId) $ \a ->
readJSON (showJSON a) ==? Ok a
testSuite "Locking/Locks"
[ 'prop_ReadShow
, 'prop_ImpliedOrder
, 'prop_ImpliedIntervall
, 'prop_ReadShowLevel
, 'prop_ReadShow_ClientId
]
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment