Revision 69809ae3

b/test/hs/Test/Ganeti/Locking/Locks.hs
28 28

  
29 29
module Test.Ganeti.Locking.Locks (testLocking_Locks) where
30 30

  
31
import Control.Applicative ((<$>))
31
import Control.Applicative ((<$>), liftA2)
32 32

  
33 33
import Test.QuickCheck
34 34
import Text.JSON
......
68 68
  . flip all (lockImplications b) $ \a ->
69 69
  a < b
70 70

  
71
-- | Verify the intervall property of the locks.
72
prop_ImpliedIntervall :: Property
73
prop_ImpliedIntervall =
74
  forAll ((arbitrary :: Gen GanetiLocks)
75
          `suchThat` (not . null . lockImplications)) $ \b ->
76
  forAll (elements $ lockImplications b) $ \a ->
77
  forAll (arbitrary `suchThat` liftA2 (&&) (a <) (<= b)) $ \x ->
78
  printTestCase ("Locks between a group and a member of the group"
79
                 ++ " must also belong to the group")
80
  $ a `elem` lockImplications x
81

  
71 82
testSuite "Locking/Locks"
72 83
 [ 'prop_ReadShow
73 84
 , 'prop_ImpliedOrder
85
 , 'prop_ImpliedIntervall
74 86
 ]

Also available in: Unified diff