@@ -52,14 +52,30 @@ data User = User
5252 { userFirstName :: Text
5353 , userLastName :: Text
5454 } deriving (Eq, Ord, Show, Generic, NFData, Binary, Atomable)
55−
55+
56+data Test9_4T = Test9_4C {
57+ f9_41 :: Int,
58+ f9_42 :: Int,
59+ f9_43 :: Int,
60+ f9_44 :: Int }
61+ deriving (Show, Generic, Eq, Binary, NFData, Atomable)
62+
63+data Test9_5T = Test9_5C {
64+ f9_51 :: Int,
65+ f9_52 :: Int,
66+ f9_53 :: Int,
67+ f9_54 :: Int,
68+ f9_55 :: Int
69+ }
70+ deriving (Show, Generic, Eq, Binary, NFData, Atomable)
71+
5672main :: IO ()
5773main = do
5874 tcounts <- runTestTT testList
5975 if errors tcounts + failures tcounts > 0 then exitFailure else exitSuccess
6076
6177testList :: Test
62−testList = TestList [testHaskell2DB, testADT1, testADT2, testADT3, testADT4, testADT5, testBasicMarshaling, testListInstance, testNonEmptyInstance, testADT6Maybe, testADT7Either, testNonPrimitiveValues, testRecordType]
78+testList = TestList [testHaskell2DB, testADT1, testADT2, testADT3, testADT4, testADT5, testBasicMarshaling, testListInstance, testNonEmptyInstance, testADT6Maybe, testADT7Either, testNonPrimitiveValues, testRecordType, testManyFields]
6379
6480-- test some basic data types like int, day, etc.
6581testBasicMarshaling :: Test
@@ -163,3 +179,13 @@ testRecordType = TestCase $ do
163179 let expected = AddTypeConstructor (ADTypeConstructorDef "User" []) [DataConstructorDef "User" [DataConstructorDefTypeConstructorArg (PrimitiveTypeConstructor "Text" TextAtomType),DataConstructorDefTypeConstructorArg (PrimitiveTypeConstructor "Text" TextAtomType)]]
164180
165181 assertEqual "User record to database context expr" expected (toAddTypeExpr (Proxy :: Proxy User))
182+
183+--test both odd and even product types with more than 2 fields
184+testManyFields :: Test
185+testManyFields = TestCase $ do
186+ let example4 = Test9_4C 1 2 3 4
187+ assertEqual "four fields product type" example4 (fromAtom (toAtom example4))
188+
189+ let example5 = Test9_5C 1 2 3 4 5
190+ assertEqual "five fields product type" example5 (fromAtom (toAtom example5))
191+