LGTM
On Tue, Mar 4, 2014 at 11:01 AM, Klaus Aehlig <[email protected]> wrote: > According to the specification in our design, if A is a group > lock and B belogs to this group, then all locks between A and B > in the lock order also must belong to A. Verify this. > > Signed-off-by: Klaus Aehlig <[email protected]> > --- > test/hs/Test/Ganeti/Locking/Locks.hs | 14 +++++++++++++- > 1 file changed, 13 insertions(+), 1 deletion(-) > > diff --git a/test/hs/Test/Ganeti/Locking/Locks.hs > b/test/hs/Test/Ganeti/Locking/Locks.hs > index 4c0c9a6..f2d6bf9 100644 > --- a/test/hs/Test/Ganeti/Locking/Locks.hs > +++ b/test/hs/Test/Ganeti/Locking/Locks.hs > @@ -28,7 +28,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, > Boston, MA > > module Test.Ganeti.Locking.Locks (testLocking_Locks) where > > -import Control.Applicative ((<$>)) > +import Control.Applicative ((<$>), liftA2) > > import Test.QuickCheck > import Text.JSON > @@ -68,7 +68,19 @@ prop_ImpliedOrder = > . flip all (lockImplications b) $ \a -> > a < b > > +-- | Verify the intervall property of the locks. > +prop_ImpliedIntervall :: Property > +prop_ImpliedIntervall = > + forAll ((arbitrary :: Gen GanetiLocks) > + `suchThat` (not . null . lockImplications)) $ \b -> > + forAll (elements $ lockImplications b) $ \a -> > + forAll (arbitrary `suchThat` liftA2 (&&) (a <) (<= b)) $ \x -> > + printTestCase ("Locks between a group and a member of the group" > + ++ " must also belong to the group") > + $ a `elem` lockImplications x > + > testSuite "Locking/Locks" > [ 'prop_ReadShow > , 'prop_ImpliedOrder > + , 'prop_ImpliedIntervall > ] > -- > 1.9.0.279.gdc9e3eb > >
