diff options
author | Adam Vogt <vogt.adam@gmail.com> | 2014-05-07 04:49:30 +0200 |
---|---|---|
committer | Adam Vogt <vogt.adam@gmail.com> | 2014-05-07 04:49:30 +0200 |
commit | 77983153f9e891f1199c8faa16dcb2a0e8bcbbb9 (patch) | |
tree | 000f6d063c9f82a401550c58f2540836995aed6f /tests/Properties/Screen.hs | |
parent | f9cef5a2c4fe643f2d2230e3f027e8c9884c7cdb (diff) | |
download | xmonad-77983153f9e891f1199c8faa16dcb2a0e8bcbbb9.tar.gz xmonad-77983153f9e891f1199c8faa16dcb2a0e8bcbbb9.tar.xz xmonad-77983153f9e891f1199c8faa16dcb2a0e8bcbbb9.zip |
make the check for overflow cleaner
Ignore-this: c12448f9219c8a29f2707526691acfda
darcs-hash:20140507024930-1499c-52860fb59794c3f370f27158b0936f845fce6ded.gz
Diffstat (limited to 'tests/Properties/Screen.hs')
-rw-r--r-- | tests/Properties/Screen.hs | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/tests/Properties/Screen.hs b/tests/Properties/Screen.hs index ed9d12b..cf76252 100644 --- a/tests/Properties/Screen.hs +++ b/tests/Properties/Screen.hs @@ -1,6 +1,7 @@ {-# LANGUAGE ScopedTypeVariables #-} module Properties.Screen where +import Utils import Test.QuickCheck import Instances @@ -53,8 +54,8 @@ prop_aspect_hint_shrink hint (w,h) = case applyAspectHint hint (w,h) of prop_aspect_fits = forAll ((,,,) <$> pos <*> pos <*> pos <*> pos) $ \ (x,y,a,b) -> let f v = applyAspectHint ((x, y+a), (x+b, y)) v - overflow = or [ mul x (y+a), mul (x+b) y ] - in not overflow ==> f (x,y) == (x,y) + in and [ noOverflows (*) x (y+a), noOverflows (*) (x+b) y ] + ==> f (x,y) == (x,y) where pos = choose (0, 65535) mul a b = toInteger (a*b) /= toInteger a * toInteger b @@ -65,10 +66,8 @@ prop_point_within r @ (Rectangle x y w h) = choose (0, fromIntegral h - 1)) $ \(dx,dy) -> and [ dx > 0, dy > 0, - noOverflow x w, - noOverflow y h ] + noOverflows (\ a b -> a + abs b) x w, + noOverflows (\ a b -> a + abs b) y h ] ==> pointWithin (x+dx) (y+dy) r - where - noOverflow a b = (a + fromIntegral (abs b)) > a prop_point_within_mirror r (x,y) = pointWithin x y r == pointWithin y x (mirrorRect r) |