@@ -3,7 +3,7 @@ import TutorialD.Interpreter.TestBase
33import TutorialD.Interpreter
44import TutorialD.Interpreter.Base
55import Test.HUnit
6−import ProjectM36.Relation
6+import ProjectM36.Relation as R
77import ProjectM36.Tuple
88import ProjectM36.TupleSet
99import ProjectM36.Error
@@ -121,7 +121,7 @@ main = do
121121 simpleEitherIntTextAttributes = A.attributesFromList [Attribute "a" (eitherAtomType IntegerAtomType TextAtomType)]
122122 simpleProjectionAttributes = A.attributesFromList [Attribute "c" IntegerAtomType]
123123 nestedRelationAttributes = A.attributesFromList [Attribute "a" IntegerAtomType, Attribute "b" (RelationAtomType $ A.attributesFromList [Attribute "a" IntegerAtomType])]
124− extendTestAttributes = A.attributesFromList [Attribute "a" IntegerAtomType, Attribute "b" $ RelationAtomType (attributes suppliersRel)]
124+ extendTestAttributes = A.attributesFromList [Attribute "a" IntegerAtomType, Attribute "b" $ RelationAtomType (R.attributes suppliersRel)]
125125 byteStringAttributes = A.attributesFromList [Attribute "y" ByteStringAtomType]
126126 groupCountAttrs = A.attributesFromList [Attribute "z" IntegerAtomType]
127127 minMaxAttrs = A.attributesFromList [Attribute "s#" TextAtomType, Attribute "z" IntegerAtomType]
@@ -133,10 +133,10 @@ main = do
133133 else Right tuple) suppliersRel
134134 dateExampleRelTests = [("x:=s where true", Right suppliersRel),
135135 ("x:=s where city = \"London\"", restrict (\tuple -> pure $ atomForAttributeName "city" tuple == (Right $ TextAtom "London")) suppliersRel),
136− ("x:=s where false", Right $ Relation (attributes suppliersRel) emptyTupleSet),
137− ("x:=p where color=\"Blue\" and city=\"Paris\"", mkRelationFromList (attributes productsRel) [[TextAtom "P5", TextAtom "Cam", TextAtom "Blue", IntegerAtom 12, TextAtom "Paris"]]),
136+ ("x:=s where false", Right $ Relation (R.attributes suppliersRel) emptyTupleSet),
137+ ("x:=p where color=\"Blue\" and city=\"Paris\"", mkRelationFromList (R.attributes productsRel) [[TextAtom "P5", TextAtom "Cam", TextAtom "Blue", IntegerAtom 12, TextAtom "Paris"]]),
138138 ("a:=s; update a (status:=50); x:=a{status}", mkRelation (A.attributesFromList [Attribute "status" IntegerAtomType]) (RelationTupleSet [mkRelationTuple (A.attributesFromList [Attribute "status" IntegerAtomType]) (V.fromList [IntegerAtom 50])])),
139− ("x:=s minus (s where status=20)", mkRelationFromList (attributes suppliersRel) [[TextAtom "S2", TextAtom "Jones", IntegerAtom 10, TextAtom "Paris"], [TextAtom "S3", TextAtom "Blake", IntegerAtom 30, TextAtom "Paris"], [TextAtom "S5", TextAtom "Adams", IntegerAtom 30, TextAtom "Athens"]]),
139+ ("x:=s minus (s where status=20)", mkRelationFromList (R.attributes suppliersRel) [[TextAtom "S2", TextAtom "Jones", IntegerAtom 10, TextAtom "Paris"], [TextAtom "S3", TextAtom "Blake", IntegerAtom 30, TextAtom "Paris"], [TextAtom "S5", TextAtom "Adams", IntegerAtom 30, TextAtom "Athens"]]),
140140 --atom function tests
141141 ("x:=((s : {status2 := add(10,@status)}) where status2=add(10,@status)){city,s#,sname,status}", Right suppliersRel),
142142 ("x:=relation{tuple{a 5}} : {b:=s}", mkRelation extendTestAttributes (RelationTupleSet [mkRelationTuple extendTestAttributes (V.fromList [IntegerAtom 5, RelationAtom suppliersRel])])),
@@ -149,11 +149,11 @@ main = do
149149 ("x:=((sp{s#,qty}) group ({qty} as x):{z:=min(@x)}){s#,z}", mkRelationFromList minMaxAttrs (map (\(s,i) -> [TextAtom s,IntegerAtom i]) [("S1", 100), ("S2", 300), ("S3", 200), ("S4", 200)])),
150150 ("x:=((sp{s#,qty}) group ({qty} as x):{z:=sum(@x)}){s#,z}", mkRelationFromList minMaxAttrs (map (\(s,i) -> [TextAtom s,IntegerAtom i]) [("S1", 1000), ("S2", 700), ("S3", 200), ("S4", 900)])),
151151 --boolean function restriction
152− ("x:=s where ^lt(@status,20)", mkRelationFromList (attributes suppliersRel) [[TextAtom "S2", TextAtom "Jones", IntegerAtom 10, TextAtom "Paris"]]),
153− ("x:=s where ^gt(@status,20)", mkRelationFromList (attributes suppliersRel) [[TextAtom "S3", TextAtom "Blake", IntegerAtom 30, TextAtom "Paris"],
152+ ("x:=s where ^lt(@status,20)", mkRelationFromList (R.attributes suppliersRel) [[TextAtom "S2", TextAtom "Jones", IntegerAtom 10, TextAtom "Paris"]]),
153+ ("x:=s where ^gt(@status,20)", mkRelationFromList (R.attributes suppliersRel) [[TextAtom "S3", TextAtom "Blake", IntegerAtom 30, TextAtom "Paris"],
154154 [TextAtom "S5", TextAtom "Adams", IntegerAtom 30, TextAtom "Athens"]]),
155155 ("x:=s where ^sum(@status)", Left $ AtomTypeMismatchError IntegerAtomType BoolAtomType),
156− ("x:=s where ^not(gte(@status,20))", mkRelationFromList (attributes suppliersRel) [[TextAtom "S2", TextAtom "Jones", IntegerAtom 10, TextAtom "Paris"]]),
156+ ("x:=s where ^not(gte(@status,20))", mkRelationFromList (R.attributes suppliersRel) [[TextAtom "S2", TextAtom "Jones", IntegerAtom 10, TextAtom "Paris"]]),
157157 --test "all but" attribute inversion syntax
158158 ("x:=s{all but s#} = s{city,sname,status}", Right relationTrue),
159159 --test key syntax
@@ -202,6 +202,7 @@ transactionGraphAddCommitTest = TestCase $ do
202202 DisplayResult _ -> assertFailure "display?"
203203 DisplayIOResult _ -> assertFailure "displayIO?"
204204 DisplayRelationResult _ -> assertFailure "displayrelation?"
205+ DisplayDataFrameResult _ -> assertFailure "displaydataframe?"
205206 DisplayParseErrorResult _ _ -> assertFailure "displayparseerror?"
206207 DisplayErrorResult err -> assertFailure (show err)
207208 QuietSuccessResult -> do
@@ -522,7 +523,7 @@ testRestrictionPredicateExprs = TestCase $ do
522523 -- and
523524 executeTutorialD sessionId dbconn "x:=s where status=20 and status=10"
524525 eRvAnd <- executeRelationalExpr sessionId dbconn (RelationVariable "x" ())
525− let expectedRelAnd = Right (emptyRelationWithAttrs (attributes suppliersRel))
526+ let expectedRelAnd = Right (emptyRelationWithAttrs (R.attributes suppliersRel))
526527 assertEqual "status 20 and 10" expectedRelAnd eRvAnd
527528
528529testRelationalAttributeNames :: Test
@@ -533,7 +534,7 @@ testRelationalAttributeNames = TestCase $ do
533534 case eRv of
534535 Left err -> assertFailure (show err)
535536 Right rel ->
536− assertEqual "attributes from sp" (attributes supplierProductsRel) (attributes rel)
537+ assertEqual "attributes from sp" (R.attributes supplierProductsRel) (R.attributes rel)
537538
538539testSemijoin :: Test
539540testSemijoin = TestCase $ do