@@ -2,6 +2,7 @@ import Test.HUnit
22import RelationType
33import Relation
44import RelationTuple
5+import RelationTupleSet
56import qualified Data.Set as S
67import qualified Data.Map as M
78import qualified Data.HashSet as HS
@@ -49,6 +50,7 @@ validateAttrTypesMatchTupleAttrTypes rel@(Relation _ tupMapSet)
4950
5051simpleRel = case mkRelation attrs tupleSet of
5152 Right rel -> rel
53+ Left err -> undefined
5254 where
5355 attrs = M.fromList [("a", Attribute "a" StringAtomType), ("b", Attribute "b" StringAtomType)]
5456 tupleSet = HS.fromList $ mkRelationTuples attrs [
@@ -62,4 +64,11 @@ testRename1 = TestCase $ assertEqual "attribute invalid" (rename "a" "b" relatio
6264testRename2 :: Test
6365testRename2 = TestCase $ assertEqual "attribute in use" (rename "b" "a" simpleRel) (Left $ RelationalError 1 "Attribute \"a\" already in use.")
6466
65−
67+--mkRelation tests
68+--test tupleset key mismatch failure
69+testMkRelation1 :: Test
70+testMkRelation1 = TestCase $ assertEqual "key mismatch" (mkRelation testAttrs testTupSet) (Left $ RelationalError 1 "Tuple values not of the same type for same keys")
71+ where
72+ testAttrs = M.singleton "a" (Attribute "a" StringAtomType)
73+ testTupSet = HS.fromList [(RelationTuple (M.singleton "a" $ StringAtom "v")),
74+ RelationTuple (M.singleton "a" $ IntAtom 2)]