make quickcheck tests friendlier to read.

This commit is contained in:
David Roundy
2007-05-05 17:54:15 +00:00
parent ab0f3be0af
commit ab27c7d48d
2 changed files with 7 additions and 2 deletions

View File

@@ -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

View File

@@ -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)