summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorDon Stewart <dons@cse.unsw.edu.au>2007-04-30 08:29:01 +0200
committerDon Stewart <dons@cse.unsw.edu.au>2007-04-30 08:29:01 +0200
commitd437519fb37afd8a743d6165fe5b764a003b0925 (patch)
tree29562f88a39d029d9a4f6e0eccc0ddce6dddd49d /tests
parent4a9ace968e790f91fcd0093e283bdfa2fb6a6328 (diff)
downloadmetatile-d437519fb37afd8a743d6165fe5b764a003b0925.tar
metatile-d437519fb37afd8a743d6165fe5b764a003b0925.zip
view n . shift n . view i . shift i) x == x --> shift + view is invertible
darcs-hash:20070430062901-9c5c1-dd591516cb05072be929aa68d42be3b27476bd5a
Diffstat (limited to 'tests')
-rw-r--r--tests/Properties.hs12
1 files changed, 8 insertions, 4 deletions
diff --git a/tests/Properties.hs b/tests/Properties.hs
index b49cbd3..ba82fdc 100644
--- a/tests/Properties.hs
+++ b/tests/Properties.hs
@@ -142,10 +142,12 @@ prop_view_idem (x :: T) r =
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
- where _ = x :: T
+prop_shift_reversible r (x :: T) =
+ let i = fromIntegral $ r `mod` sz
+ sz = size x
+ n = current x
+ in height n x > 0 ==> (view n . shift n . view i . shift i) x == x
+
prop_fullcache x = cached == allvals where
cached = sort . keys $ cache x
@@ -323,6 +325,8 @@ main = do
,("view/view ", mytest prop_viewview)
,("view idem ", mytest prop_view_idem)
+ ,("shift reversible ", mytest prop_shift_reversible)
+
,("fullcache ", mytest prop_fullcache)
,("currentwsvisible ", mytest prop_currentwsvisible)
,("ws screen mapping", mytest prop_ws2screen_screen2ws)