1import TutorialDInterpreter
7import qualified Data.HashSet as HS
8import qualified Data.Map as M
12 counts <- runTestTT (TestList tests)
13 if errors counts + failures counts > 0 then exitFailure else exitSuccess
15 tests = map (\(tutd, expected) -> TestCase $ assertTutdEqual basicDatabaseContext tutd expected) simpleRelTests
16 simpleRelTests = [("x:=true", Right relationTrue),
17 ("x:=false", Right relationFalse),
18 ("x:=true union false", Right relationTrue),
19 ("x:=true; x:=false", Right relationFalse),
20 ("x:=relation{a int}", mkRelation simpleAAttributes HS.empty),
21 ("x:=relation{c int} rename {c as d}", mkRelation simpleBAttributes HS.empty),
22 ("y:=relation{b int, c int}; x:=y{c}", mkRelation simpleProjectionAttributes HS.empty),
23 ("constraint failc true in false; x:=true", Left $ InclusionDependencyCheckError "failc")
25 simpleAAttributes = M.fromList [("a", Attribute "a" IntAtomType)]
26 simpleBAttributes = M.fromList [("d", Attribute "d" IntAtomType)]
27 simpleProjectionAttributes = M.fromList [("c", Attribute "c" IntAtomType)]
30testSimple1 = TestCase $ assertTutdEqual basicDatabaseContext "true" (Right relationTrue)
32assertTutdEqual databaseContext tutd expected = assertEqual tutd interpreted expected
34 interpreted = case interpret databaseContext tutd of
35 (Just err, _) -> Left err
36 (Nothing, context) -> Right $ (relationVariables context) M.! "x"
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list