on 49ed722 help sign in
project-m36/TutorialDInterpreterTest.hs
25 lines 920 B history raw
1import TutorialDInterpreter
2import Test.HUnit
3import RelationExpr
4import Relation
5import RelationType
6import qualified Data.HashSet as HS
7import qualified Data.Map as M
9main = runTestTT (TestList tests)
10 where
11 tests = map (\(tutd, expected)->TestCase $ assertTutdEqual tutd expected) simpleRelTests
12 simpleRelTests = [("true", Right relationTrue),
13 ("false", Right relationFalse),
14 ("true union false", Right relationTrue),
15 ("true; false", Right relationFalse),
16 ("a:=relation{a int}", mkRelation simpleAAttributes HS.empty)
17 ]
18 simpleAAttributes = M.fromList [("a", Attribute "a" IntAtomType)]
21testSimple1 = TestCase $ assertTutdEqual "true" (Right relationTrue)
23assertTutdEqual tutd expected = assertEqual tutd interpreted expected
24 where
25 interpreted = fst (interpret basicRelVarContext tutd)