@@ -9,58 +9,22 @@ module Web.Internal.TestInstances
11import Control.Applicative
11import Control.Applicative
12−import qualified Data.ByteString.Lazy.Char8 as BSL
13import Data.Char
12import Data.Char
14import qualified Data.HashMap.Strict as HashMap
13import qualified Data.HashMap.Strict as HashMap
15import qualified Data.Text as T
14import qualified Data.Text as T
16−import qualified Data.Text.Lazy as L
17import Data.Time
15import Data.Time
19import GHC.Exts (fromList)
16import GHC.Exts (fromList)
20import GHC.Generics
17import GHC.Generics
22import Test.QuickCheck
19import Test.QuickCheck
20+import Test.QuickCheck.Instances ()
24import Web.Internal.FormUrlEncoded
22import Web.Internal.FormUrlEncoded
25import Web.Internal.HttpApiData
23import Web.Internal.HttpApiData
27−instance Arbitrary T.Text where
28− arbitrary = T.pack <$> arbitrary
30−instance Arbitrary L.Text where
31− arbitrary = L.pack <$> arbitrary
33−instance Arbitrary BSL.ByteString where
34− arbitrary = BSL.pack <$> arbitrary
36−instance Arbitrary Day where
37− arbitrary = liftA3 fromGregorian (fmap abs arbitrary) arbitrary arbitrary
39−instance Arbitrary LocalTime where
40− arbitrary = LocalTime
42− <*> liftA3 TimeOfDay (choose (0, 23)) (choose (0, 59)) (fromInteger <$> choose (0, 60))
44instance Eq ZonedTime where
25instance Eq ZonedTime where
45 ZonedTime t (TimeZone x _ _) == ZonedTime t' (TimeZone y _ _) = t == t' && x == y
26 ZonedTime t (TimeZone x _ _) == ZonedTime t' (TimeZone y _ _) = t == t' && x == y
47−instance Arbitrary ZonedTime where
48− arbitrary = ZonedTime
50− <*> liftA3 TimeZone arbitrary arbitrary (vectorOf 3 (elements ['A'..'Z']))
52−instance Arbitrary UTCTime where
53− arbitrary = UTCTime <$> arbitrary <*> fmap fromInteger (choose (0, 86400))
55−instance Arbitrary NominalDiffTime where
56− arbitrary = fromInteger <$> arbitrary
58−instance Arbitrary Version where
59− arbitrary = (version . map abs) <$> nonempty
61− version branch = Version branch []
62− nonempty = liftA2 (:) arbitrary arbitrary
64instance Arbitrary Form where
28instance Arbitrary Form where
65 arbitrary = fromList <$> arbitrary
29 arbitrary = fromList <$> arbitrary