@@ -18,6 +18,8 @@ import System.Exit
18import Data.Maybe (isJust)
18import Data.Maybe (isJust)
19import System.IO
19import System.IO
20import qualified Data.Vector as V
20import qualified Data.Vector as V
21+import Data.Typeable (Proxy(..))
22+import Data.Text (Text)
22--urgent: add group and ungroup tests- I missed the group relation type bug
24--urgent: add group and ungroup tests- I missed the group relation type bug
23main :: IO ()
25main :: IO ()
@@ -59,6 +61,8 @@ main = do
59 simpleBAttributes = A.attributesFromList [Attribute "d" intAtomType]
61 simpleBAttributes = A.attributesFromList [Attribute "d" intAtomType]
60 simpleCAttributes = A.attributesFromList [Attribute "a" stringAtomType, Attribute "b" intAtomType]
62 simpleCAttributes = A.attributesFromList [Attribute "a" stringAtomType, Attribute "b" intAtomType]
61 simpleDAttributes = A.attributesFromList [Attribute "a" intAtomType, Attribute "b" intAtomType]
63 simpleDAttributes = A.attributesFromList [Attribute "a" intAtomType, Attribute "b" intAtomType]
64+ simpleMaybeTextAttributes = A.attributesFromList [Attribute "a" $ atomTypeForProxy (Proxy :: Proxy (Maybe Text))]
65+ simpleMaybeIntAttributes = A.attributesFromList [Attribute "a" $ atomTypeForProxy (Proxy :: Proxy (Maybe Int))]
62 simpleProjectionAttributes = A.attributesFromList [Attribute "c" intAtomType]
66 simpleProjectionAttributes = A.attributesFromList [Attribute "c" intAtomType]
63 nestedRelationAttributes = A.attributesFromList [Attribute "a" intAtomType, Attribute "b" (RelationAtomType $ A.attributesFromList [Attribute "a" intAtomType])]
67 nestedRelationAttributes = A.attributesFromList [Attribute "a" intAtomType, Attribute "b" (RelationAtomType $ A.attributesFromList [Attribute "a" intAtomType])]
64 extendTestAttributes = A.attributesFromList [Attribute "a" intAtomType, Attribute "b" $ RelationAtomType (attributes suppliersRel)]
68 extendTestAttributes = A.attributesFromList [Attribute "a" intAtomType, Attribute "b" $ RelationAtomType (attributes suppliersRel)]
@@ -89,7 +93,11 @@ main = do
89 ("x:=S{all but S#} = S{CITY,SNAME,STATUS}", Right $ relationTrue),
93 ("x:=S{all but S#} = S{CITY,SNAME,STATUS}", Right $ relationTrue),
90 --test key syntax
94 --test key syntax
91 ("x:=S; key testconstraint {S#,CITY} x; insert x relation{tuple{CITY \"London\", S# \"S1\", SNAME \"gonk\", STATUS 50}}", Left (InclusionDependencyCheckError "testconstraint")),
95 ("x:=S; key testconstraint {S#,CITY} x; insert x relation{tuple{CITY \"London\", S# \"S1\", SNAME \"gonk\", STATUS 50}}", Left (InclusionDependencyCheckError "testconstraint")),
92− ("y:=S; key testconstraint {S#} y; insert y relation{tuple{CITY \"London\", S# \"S6\", SNAME \"gonk\", STATUS 50}}; x:=y{S#} = S{S#} union relation{tuple{S# \"S6\"}}", Right $ relationTrue)
96+ ("y:=S; key testconstraint {S#} y; insert y relation{tuple{CITY \"London\", S# \"S6\", SNAME \"gonk\", STATUS 50}}; x:=y{S#} = S{S#} union relation{tuple{S# \"S6\"}}", Right $ relationTrue),
98+ ("x:=relation{tuple{a Just \"spam\"::maybe char}}", mkRelationFromList simpleMaybeTextAttributes [[Atom (Just "spam" :: Maybe Text)]]),
100+ ("x:=relation{tuple{a Just 3::maybe int}}", mkRelationFromList simpleMaybeIntAttributes [[Atom (Just 3 :: Maybe Int)]])