This includes:
* The operator (/=?), which checks for inequality and prints
an error message if it encounters equality. (Basically the
negation of the (==?) operator).
* Application of this operator in the test property
prop_addPri_NoN1Fail.
Signed-off-by: Helga Velroyen <helgav@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>
forAll genOnlineNode $ \node ->
forAll (genInstanceSmallerThanNode node) $ \inst ->
let inst' = inst { Instance.mem = Node.fMem node - Node.rMem node }
- in case Node.addPri node inst' of
- Bad Types.FailN1 -> False
- _ -> True
+ in (Node.addPri node inst' /=? Bad Types.FailN1)
-- | Check that an instance add with too high memory or disk will be
-- rejected.
show x ++ "' /= '" ++ show y ++ "'") (x == y)
infix 3 ==?
+-- | Checks for inequality with proper annotation.
+(/=?) :: (Show a, Eq a) => a -> a -> Property
+(/=?) x y = printTestCase
+ ("Expected inequality, but got equality: '" ++
+ show x ++ "'.") (x /= y)
+infix 3 /=?
+
-- | Show a message and fail the test.
failTest :: String -> Property
failTest msg = printTestCase msg False