aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorDon Stewart <dons@cse.unsw.edu.au>2007-04-30 07:57:51 +0200
committerDon Stewart <dons@cse.unsw.edu.au>2007-04-30 07:57:51 +0200
commitcd33fd1c27e530ce9004da0d53f77c99a69414fb (patch)
tree87a0ed3dff44f6dd995e6b0f124b1c0253d61fc6 /tests
parent591c5a22f1a5c691f0d1e15ce0cbe739d4d6dd1d (diff)
downloadxmonad-cd33fd1c27e530ce9004da0d53f77c99a69414fb.tar.gz
xmonad-cd33fd1c27e530ce9004da0d53f77c99a69414fb.tar.xz
xmonad-cd33fd1c27e530ce9004da0d53f77c99a69414fb.zip
add rotate all and view idempotency tests
darcs-hash:20070430055751-9c5c1-da5da09a5c2ff160fb7b243794d5fd3d7f954cb1.gz
Diffstat (limited to 'tests')
-rw-r--r--tests/Properties.hs22
1 files changed, 19 insertions, 3 deletions
diff --git a/tests/Properties.hs b/tests/Properties.hs
index d8b0a48..b49cbd3 100644
--- a/tests/Properties.hs
+++ b/tests/Properties.hs
@@ -119,8 +119,15 @@ prop_delete2 i x =
prop_focus1 i x = member i x ==> peek (raiseFocus i x) == Just i
where _ = x :: T
-prop_rotaterotate x = rotate LT (rotate GT x) == x
- where _ = x :: T
+-- rotation is reversible in two directions
+prop_rotaterotate1 (x :: T) = rotate LT (rotate GT x) == x
+prop_rotaterotate2 (x :: T) = rotate GT (rotate LT x) == x
+
+-- rotation through the height of a stack gets us back to the start
+prop_rotate_all (x :: T) = foldr (\_ y -> rotate GT y) x [1..n] == x
+ where
+ n = height (current x) x
+
prop_viewview r x =
let n = current x
@@ -130,6 +137,11 @@ prop_viewview r x =
where _ = x :: T
+prop_view_idem (x :: T) r =
+ let i = fromIntegral $ r `mod` sz
+ sz = size x
+ in view i (view i x) == (view i x)
+
prop_shiftshift r x =
let n = current x
in shift n (shift r x) == x
@@ -304,9 +316,13 @@ main = do
,("focus", mytest prop_focus1)
- ,("rotate/rotate ", mytest prop_rotaterotate)
+ ,("rotate l >> rotate r", mytest prop_rotaterotate1)
+ ,("rotate r >> rotate l", mytest prop_rotaterotate2)
+ ,("rotate all", mytest prop_rotate_all)
,("view/view ", mytest prop_viewview)
+ ,("view idem ", mytest prop_view_idem)
+
,("fullcache ", mytest prop_fullcache)
,("currentwsvisible ", mytest prop_currentwsvisible)
,("ws screen mapping", mytest prop_ws2screen_screen2ws)