diff --git a/Test/Vector.hs b/Test/Vector.hs index f64ddb4..52c1423 100644 --- a/Test/Vector.hs +++ b/Test/Vector.hs @@ -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 diff --git a/TestMain.hs b/TestMain.hs index 8379adb..74f0658 100644 --- a/TestMain.hs +++ b/TestMain.hs @@ -17,6 +17,7 @@ main = do deepCheck inRangeProp3 deepCheck inRangeProp4 deepCheck inRangeProp5 + deepCheck inRangeProp6 putStrLn "testing onPT:" deepCheck onPTProp1 deepCheck onPTProp2