on 1.4.5.0 help sign in
typeable/aeson/tests/PropertyRoundTrip.hs
74 lines 3.5 kB history raw
1{-# LANGUAGE NoImplicitPrelude #-}
3module PropertyRoundTrip ( roundTripTests ) where
5import Prelude.Compat
7import Control.Applicative (Const)
8import Data.Aeson.Types
9import Data.DList (DList)
10import Data.List.NonEmpty (NonEmpty)
11import Data.Proxy (Proxy)
12import Data.Ratio (Ratio)
13import Data.Sequence (Seq)
14import Data.Tagged (Tagged)
15import Data.Time (Day, DiffTime, LocalTime, NominalDiffTime, TimeOfDay, UTCTime, ZonedTime)
16import Data.Version (Version)
17import Data.Time.Calendar.Compat (CalendarDiffDays, DayOfWeek)
18import Data.Time.LocalTime.Compat (CalendarDiffTime)
19import Data.Time.Clock.System.Compat (SystemTime)
20import Instances ()
21import Numeric.Natural (Natural)
22import Test.Tasty (TestTree, testGroup)
23import Test.Tasty.QuickCheck (testProperty)
24import Types
25import qualified Data.Text as T
26import qualified Data.Text.Lazy as LT
27import qualified Data.UUID.Types as UUID
28import PropUtils
29import PropertyRTFunctors
32roundTripTests :: TestTree
33roundTripTests =
34 testGroup "roundTrip" [
35 testProperty "Bool" $ roundTripEq True
36 , testProperty "Double" $ roundTripEq (1 :: Approx Double)
37 , testProperty "Int" $ roundTripEq (1 :: Int)
38 , testProperty "NonEmpty Char" $ roundTripEq (undefined :: NonEmpty Char)
39 , testProperty "Integer" $ roundTripEq (1 :: Integer)
40 , testProperty "String" $ roundTripEq ("" :: String)
41 , testProperty "Text" $ roundTripEq T.empty
42 , testProperty "Lazy Text" $ roundTripEq LT.empty
43 , testProperty "Foo" $ roundTripEq (undefined :: Foo)
44 , testProperty "Day" $ roundTripEq (undefined :: Day)
45 , testProperty "BCE Day" $ roundTripEq (undefined :: BCEDay)
46 , testProperty "DotNetTime" $ roundTripEq (undefined :: Approx DotNetTime)
47 , testProperty "LocalTime" $ roundTripEq (undefined :: LocalTime)
48 , testProperty "TimeOfDay" $ roundTripEq (undefined :: TimeOfDay)
49 , testProperty "UTCTime" $ roundTripEq (undefined :: UTCTime)
50 , testProperty "ZonedTime" $ roundTripEq (undefined :: ZonedTime)
51 , testProperty "NominalDiffTime" $ roundTripEq (undefined :: NominalDiffTime)
52 , testProperty "DiffTime" $ roundTripEq (undefined :: DiffTime)
53 , testProperty "DayOfWeek" $ roundTripEq (undefined :: DayOfWeek)
54 , testProperty "SystemTime" $ roundTripEq (undefined :: SystemTime)
55 , testProperty "CalendarDiffTime" $ roundTripEq (undefined :: CalendarDiffTime)
56 , testProperty "CalendarDiffDays" $ roundTripEq (undefined :: CalendarDiffDays)
57 , testProperty "Version" $ roundTripEq (undefined :: Version)
58 , testProperty "Natural" $ roundTripEq (undefined :: Natural)
59 , testProperty "Proxy" $ roundTripEq (undefined :: Proxy Int)
60 , testProperty "Tagged" $ roundTripEq (undefined :: Tagged Int Char)
61 , testProperty "Const" $ roundTripEq (undefined :: Const Int Char)
62 , testProperty "DList" $ roundTripEq (undefined :: DList Int)
63 , testProperty "Seq" $ roundTripEq (undefined :: Seq Int)
64 , testProperty "Rational" $ roundTripEq (undefined :: Rational)
65 , testProperty "Ratio Int" $ roundTripEq (undefined :: Ratio Int)
66 , testProperty "UUID" $ roundTripEq UUID.nil
67 , roundTripFunctorsTests
68 , testGroup "ghcGenerics" [
69 testProperty "OneConstructor" $ roundTripEq OneConstructor
70 , testProperty "Product2" $ roundTripEq (undefined :: Product2 Int Bool)
71 , testProperty "Product6" $ roundTripEq (undefined :: P6)
72 , testProperty "Sum4" $ roundTripEq (undefined :: S4)
73 ]
74 ]