Safe Haskell | None |
---|
Tests for lock allocation.
Synopsis
- data TestOwner = TestOwner Int
- data TestLock
- = TestBigLock
- | TestCollectionLockA
- | TestLockA Int
- | TestCollectionLockB
- | TestLockB Int
- data UpdateRequest b a
- = UpdateRequest b [LockRequest a]
- | FreeLockRequest b
- asAllocTrans :: (Lock a, Ord b, Show b) => LockAllocation a b -> UpdateRequest b a -> LockAllocation a b
- foldUpdates :: (Lock a, Ord b, Show b) => [UpdateRequest b a] -> LockAllocation a b
- prop_LocksDisjoint :: Property
- prop_LockslistComplete :: Property
- prop_LocksAllOwnersSubsetLockslist :: Property
- prop_LocksAllOwnersComplete :: Property
- prop_LocksAllOwnersSound :: Property
- prop_LockImplicationX :: Property
- prop_LockImplicationS :: Property
- prop_LocksStable :: Property
- requestSucceeded :: Ord a => Map a OwnerState -> LockRequest a -> Bool
- prop_LockupdateAtomic :: Property
- prop_LockReleaseSucceeds :: Property
- prop_BlockSufficient :: Property
- prop_BlockNecessary :: Property
- prop_ReadShow :: Property
- prop_OwnerComplete :: Property
- prop_OwnerSound :: Property
- prop_ReadShowRequest :: Property
- testLocking_Allocation :: Test
Documentation
TestOwner Int |
Instances
data UpdateRequest b a Source #
UpdateRequest b [LockRequest a] | |
FreeLockRequest b |
asAllocTrans :: (Lock a, Ord b, Show b) => LockAllocation a b -> UpdateRequest b a -> LockAllocation a b Source #
Transform an UpdateRequest into the corresponding state transformer.
foldUpdates :: (Lock a, Ord b, Show b) => [UpdateRequest b a] -> LockAllocation a b Source #
Fold a sequence of requests to transform a lock allocation onto the empty allocation. As we consider all exported LockAllocation transformers, any LockAllocation definable is obtained in this way.
prop_LocksDisjoint :: Property Source #
Basic property of locking: the exclusive locks of one user are disjoint from any locks of any other user.
prop_LockslistComplete :: Property Source #
Verify that the list of active locks indeed contains all locks that are owned by someone.
prop_LocksAllOwnersSubsetLockslist :: Property Source #
Verify that the list of all locks with states is contained in the list of all locks.
prop_LocksAllOwnersComplete :: Property Source #
Verify that all locks of all owners are mentioned in the list of all locks' owner's state.
prop_LocksAllOwnersSound :: Property Source #
Verify that all lock owners mentioned in the list of all locks' owner's state actually own their lock.
prop_LockImplicationX :: Property Source #
Verify that exclusive group locks are honored, i.e., verify that if someone holds a lock, then no one else can hold a lock on an exclusive lock on an implied lock.
prop_LockImplicationS :: Property Source #
Verify that shared group locks are honored, i.e., verify that if someone holds an exclusive lock, then no one else can hold any form on lock on an implied lock.
prop_LocksStable :: Property Source #
Verify that locks can only be modified by updates of the owner.
requestSucceeded :: Ord a => Map a OwnerState -> LockRequest a -> Bool Source #
Verify that a given request is statisfied in list of owned locks
prop_LockupdateAtomic :: Property Source #
Verify that lock updates are atomic, i.e., either we get all the required locks, or the state is completely unchanged.
prop_LockReleaseSucceeds :: Property Source #
Verify that releasing a lock always succeeds.
prop_BlockSufficient :: Property Source #
Verify the property that only the blocking owners prevent lock allocation. We deliberatly go for the expensive variant restraining by suchThat, as otherwise the number of cases actually covered is too small.
prop_BlockNecessary :: Property Source #
Verify the property that every blocking owner is necessary, i.e., even if we only keep the locks of one of the blocking owners, the request still will be blocked. We deliberatly use the expensive variant of restraining to ensure good coverage. To make sure the request can always be blocked by two owners, for a shared request we request two different locks.
prop_ReadShow :: Property Source #
Verify that for LockAllocation we have readJSON . showJSON = Ok.
prop_OwnerComplete :: Property Source #
Verify that the list of lock owners is complete.
prop_OwnerSound :: Property Source #
Verify that each owner actually owns a lock.
prop_ReadShowRequest :: Property Source #
Verify that for LockRequest we have readJSON . showJSON = Ok.
testLocking_Allocation :: Test Source #
Orphan instances
Arbitrary OwnerState # | |
arbitrary :: Gen OwnerState shrink :: OwnerState -> [OwnerState] | |
Arbitrary a => Arbitrary (LockRequest a) # | |
arbitrary :: Gen (LockRequest a) shrink :: LockRequest a -> [LockRequest a] | |
(Arbitrary a, Lock a, Arbitrary b, Ord b, Show b) => Arbitrary (LockAllocation a b) # | |
arbitrary :: Gen (LockAllocation a b) shrink :: LockAllocation a b -> [LockAllocation a b] |