From ed9c92878a288fd7d25ca25bc7f882b13a20e81d Mon Sep 17 00:00:00 2001 From: Neil Brown Date: Wed, 14 May 2008 10:09:42 +0000 Subject: [PATCH] Added a helper function to RainTypesTest to make the unification tests shorter --- frontends/RainTypesTest.hs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/frontends/RainTypesTest.hs b/frontends/RainTypesTest.hs index 29008ac..0422dcf 100644 --- a/frontends/RainTypesTest.hs +++ b/frontends/RainTypesTest.hs @@ -486,10 +486,8 @@ testUnify = TestList [pass [] [] [] ,pass' [("a",A.Int)] [] ,pass' [("a",A.Int)] [("a","a")] - ,pass [("a", A.Int), ("b", A.Infer)] [("a","b")] - [("a", A.Int), ("b", A.Int)] - ,pass [("a", A.List A.Int), ("b", A.List A.Infer)] [("a","b")] - [("a", A.List A.Int), ("b", A.List A.Int)] + ,pass2 [A.Int, A.Infer] [A.Int, A.Int] + ,pass2 [A.List A.Int, A.List A.Infer] [A.List A.Int, A.List A.Int] ,fail [("a", A.Int), ("b", A.List A.Infer)] [("a","b")] ,fail [("a", A.Infer)] [] ,fail [("a", A.Infer), ("b", A.Infer)] [("a","b")] @@ -508,6 +506,10 @@ testUnify = TestList pass' :: [(String, A.Type)] -> [(String, String)] -> Test pass' x y = pass x y x + pass2 :: [A.Type] -> [A.Type] -> Test + pass2 xs ys = pass (zip names xs) (allPairs names) (zip names ys) + where + names = take (min (length xs) (length ys)) $ map (:[]) ['a'..] tests :: Test tests = TestLabel "RainTypesTest" $ TestList