@@ -8,20 +8,22 @@ import qualified Data.Map as M
9main = runTestTT (TestList tests)
9main = runTestTT (TestList tests)
11− tests = map (\(tutd, expected)->TestCase $ assertTutdEqual tutd expected) simpleRelTests
11+ tests = map (\(tutd, expected) -> TestCase $ assertTutdEqual basicRelVarContext tutd expected) simpleRelTests
12 simpleRelTests = [("true", Right relationTrue),
12 simpleRelTests = [("true", Right relationTrue),
13 ("false", Right relationFalse),
13 ("false", Right relationFalse),
14 ("true union false", Right relationTrue),
14 ("true union false", Right relationTrue),
15 ("true; false", Right relationFalse),
15 ("true; false", Right relationFalse),
16 ("a:=relation{a int}", mkRelation simpleAAttributes HS.empty),
16 ("a:=relation{a int}", mkRelation simpleAAttributes HS.empty),
17− ("b:=relation{c int} rename {c as d}", mkRelation simpleBAttributes HS.empty)
17+ ("b:=relation{c int} rename {c as d}", mkRelation simpleBAttributes HS.empty),
18+ ("a:=relation{b int, c int}; a{c}", mkRelation simpleProjectionAttributes HS.empty)
19 simpleAAttributes = M.fromList [("a", Attribute "a" IntAtomType)]
20 simpleAAttributes = M.fromList [("a", Attribute "a" IntAtomType)]
20 simpleBAttributes = M.fromList [("d", Attribute "d" IntAtomType)]
21 simpleBAttributes = M.fromList [("d", Attribute "d" IntAtomType)]
22+ simpleProjectionAttributes = M.fromList [("c", Attribute "c" IntAtomType)]
23−testSimple1 = TestCase $ assertTutdEqual "true" (Right relationTrue)
25+testSimple1 = TestCase $ assertTutdEqual basicRelVarContext "true" (Right relationTrue)
25−assertTutdEqual tutd expected = assertEqual tutd interpreted expected
27+assertTutdEqual relVarContext tutd expected = assertEqual tutd interpreted expected
27− interpreted = fst (interpret basicRelVarContext tutd)
29+ interpreted = fst (interpret relVarContext tutd)