TESTS: add inRangeProp6

This commit is contained in:
hasufell 2014-12-18 01:06:16 +01:00
parent ecce3cd9d6
commit b1ac2aa223
No known key found for this signature in database
GPG Key ID: 220CD1C5BDEED020
2 changed files with 12 additions and 0 deletions

View File

@ -114,6 +114,17 @@ inRangeProp5 sq@((x1, y1), (x2, y2)) (Positive a) (Positive b) =
inRange sq (p2 (x1 + ((x2 - x1) / (a + 1)), y1 + ((y2 - y1) / (b + 1))))
-- generating random points outside of the square
inRangeProp6 :: Square -> Positive Double -> Positive Double -> Bool
inRangeProp6 sq@((x1, y1), (x2, y2)) (Positive a) (Positive b) =
(not . inRange sq $ p2 (max x1 x2 + (a + 1), max y1 y2 + (b + 1)))
&& (not . inRange sq $ p2 (max x1 x2 + (a + 1), max y1 y2 - (b + 1)))
&& (not . inRange sq $ p2 (max x1 x2 - (a + 1), max y1 y2 + (b + 1)))
&& (not . inRange sq $ p2 (min x1 x2 - (a + 1), min y1 y2 - (b + 1)))
&& (not . inRange sq $ p2 (min x1 x2 + (a + 1), min y1 y2 - (b + 1)))
&& (not . inRange sq $ p2 (min x1 x2 - (a + 1), min y1 y2 + (b + 1)))
-- apply id function on the point
onPTProp1 :: PT -> Bool
onPTProp1 pt = onPT id pt == pt

View File

@ -17,6 +17,7 @@ main = do
deepCheck inRangeProp3
deepCheck inRangeProp4
deepCheck inRangeProp5
deepCheck inRangeProp6
putStrLn "testing onPT:"
deepCheck onPTProp1
deepCheck onPTProp2