diff options
author | Will Thompson <will@willthompson.co.uk> | 2018-12-06 22:12:16 +0000 |
---|---|---|
committer | Will Thompson <will@willthompson.co.uk> | 2018-12-06 22:12:16 +0000 |
commit | 15fb7cb53f470418fc3d1b83517388a24f34ebd9 (patch) | |
tree | 6906df18eddddba6ee63fe73bc9469f7ebf70dd4 | |
parent | c06da8b91dbbc8237dda6895116e7f498280ca80 (diff) |
Not usefulfix-tests
-rw-r--r-- | Test/Regions.hs | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/Test/Regions.hs b/Test/Regions.hs index 5e6f5b0..7cf9f88 100644 --- a/Test/Regions.hs +++ b/Test/Regions.hs @@ -13,10 +13,20 @@ newtype NonOverlappingStripes = NonOverlappingStripes [Stripe] deriving (Show, Eq, Ord) +paste :: [a] -> [(a, a)] + instance Arbitrary NonOverlappingStripes where arbitrary = do - -- listOf2 - tops <- sort <$> ((:) <$> arbitrary <*> listOf1 arbitrary) + xs <- listOf1 arbitrary + ys <- vectorOf (length xs) arbitrary + + nub . sort + + + xs <- nub . sort . map (getNonNegative) <$> listOf1 arbitrary + + heights <- + -- Generate dense stripes sometimes let g :: Gen Double @@ -45,7 +55,9 @@ instance (Eq a, Arbitrary a) => Arbitrary (RegionSelection a) where ValidRegions rs <- arbitrary return $ regionSelectionNew rs -prop_NonOverlapping_generator_works (NonOverlappingStripes ss) = nonOverlapping ss +prop_NonOverlapping_generator_works (NonOverlappingStripes ss) = all coherent ss && nonOverlapping ss + where + coherent s = stripeTop s < stripeBottom s prop_InitiallyUnselected rs = isNothing $ rsCurrent rs prop_UpDoesNothing rs = isNothing $ rsCurrent $ regionSelectionUp rs |