summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Roundy <droundy@darcs.net>2007-05-05 19:54:15 +0200
committerDavid Roundy <droundy@darcs.net>2007-05-05 19:54:15 +0200
commita888d1eb750d9df5738dabfb29337d249f2cd230 (patch)
tree3e8c7b3a9e30f211129f0f80e9d745c7c93f0e0f
parentd704d0139dd15e9edcd0f38d926d1b8c7760070a (diff)
downloadmetatile-a888d1eb750d9df5738dabfb29337d249f2cd230.tar
metatile-a888d1eb750d9df5738dabfb29337d249f2cd230.zip
make quickcheck tests friendlier to read.
darcs-hash:20070505175415-72aca-2129b8432f6f2ddb9d1498b0503b86c401020194
-rw-r--r--StackSet.hs2
-rw-r--r--tests/Properties.hs7
2 files changed, 7 insertions, 2 deletions
diff --git a/StackSet.hs b/StackSet.hs
index 7b47e06..3e35f53 100644
--- a/StackSet.hs
+++ b/StackSet.hs
@@ -46,7 +46,7 @@ data StackSet i j a =
, stacks :: !(M.Map i ([a], [a])) -- ^ screen -> (floating, normal)
, focus :: !(M.Map i a) -- ^ the window focused in each stack
, cache :: !(M.Map a i) -- ^ a cache of windows back to their stacks
- } deriving (Eq, Show)
+ } deriving (Eq, Show, Read)
-- The cache is used to check on insertion that we don't already have
-- this window managed on another stack
diff --git a/tests/Properties.hs b/tests/Properties.hs
index b4e90a6..4707305 100644
--- a/tests/Properties.hs
+++ b/tests/Properties.hs
@@ -16,6 +16,7 @@ import System.IO
import System.Random
import Text.Printf
import Data.List (nub,sort,group,sort,intersperse,genericLength)
+import Data.Char (ord)
import Data.Map (keys,elems)
import qualified Data.Map as M
@@ -121,7 +122,7 @@ prop_notpeek_peekStack n x = current x /= n && isJust (peek x) ==> peekStack n x
------------------------------------------------------------------------
-type T = StackSet Int Int Int
+type T = StackSet Int Int Char
prop_delete_uniq i x = not (member i x) ==> delete i x == x
where _ = x :: T
@@ -249,6 +250,10 @@ noOverlaps xs = and [ verts a `notOverlap` verts b
------------------------------------------------------------------------
+instance Arbitrary Char where
+ arbitrary = choose ('a','z')
+ coarbitrary n = coarbitrary (ord n)
+
instance Random Word8 where
randomR = integralRandomR
random = randomR (minBound,maxBound)