Add Arbitrary instance for RationalRect

This commit is contained in:
slotThe 2021-07-16 21:19:26 +02:00
parent 28fff7c1a2
commit 220656aab0

View File

@ -122,6 +122,10 @@ instance Arbitrary RectC where
instance Arbitrary Rectangle where instance Arbitrary Rectangle where
arbitrary = Rectangle <$> arbitrary <*> arbitrary <*> arbitrary <*> arbitrary arbitrary = Rectangle <$> arbitrary <*> arbitrary <*> arbitrary <*> arbitrary
instance Arbitrary RationalRect where
arbitrary = RationalRect <$> dim <*> dim <*> dim <*> dim
where
dim = arbitrary `suchThat` liftM2 (&&) (>= 0) (<= 1)
newtype SizedPositive = SizedPositive Int newtype SizedPositive = SizedPositive Int
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read)