From 0e3465afc09ea18598df8cc71b7ec4fed42c6ad0 Mon Sep 17 00:00:00 2001 From: Neil Brown Date: Thu, 20 Mar 2008 16:42:25 +0000 Subject: [PATCH] Corrected some Rain tests to avoid using the Int type --- common/TestUtils.hs | 5 ++++- frontends/RainTypesTest.hs | 18 +++++++++--------- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/common/TestUtils.hs b/common/TestUtils.hs index 0280e60..42e416d 100644 --- a/common/TestUtils.hs +++ b/common/TestUtils.hs @@ -192,7 +192,10 @@ intLiteralPattern = (stopCaringPattern emptyMeta) . mkPattern . intLiteral -- | Creates an integer literal 'A.Expression' with the given integer. int64Literal :: Integer -> A.Expression -int64Literal n = A.Literal emptyMeta A.Int64 $ A.IntLiteral emptyMeta (show n) +int64Literal = integerLiteral A.Int64 + +int32Literal :: Integer -> A.Expression +int32Literal = integerLiteral A.Int32 -- | Creates a 'Pattern' to match an 'A.Expression' instance. -- @'assertPatternMatch' ('intLiteralPattern' x) ('intLiteral' x)@ will always succeed. diff --git a/frontends/RainTypesTest.hs b/frontends/RainTypesTest.hs index 68533ed..daf3d11 100644 --- a/frontends/RainTypesTest.hs +++ b/frontends/RainTypesTest.hs @@ -104,20 +104,20 @@ annotateIntTest = TestList annotateListLiteralTest :: Test annotateListLiteralTest = TestList [ - testList 0 A.Int [intLiteral 0, intLiteral 1] + testList 0 A.Int32 [int32Literal 0, int32Literal 1] ,testList 1 A.Any [] - ,testList 2 A.Int [charLiteral 'c', intLiteral 6] - ,testList 3 A.Int64 [intLiteral 3, intLiteral 5, int64Literal 2, - intLiteral 2] + ,testList 2 A.Int32 [charLiteral 'c', int32Literal 6] + ,testList 3 A.Int64 [int32Literal 3, int32Literal 5, int64Literal 2, + int32Literal 2] -- TODO test with variables (and implicit upcasting) -- TODO test the type for lists of lists -- TODO test ranges with variables too - ,testRange 1000 A.Int (intLiteral 0) (intLiteral 1) - ,testRange 1001 A.Int64 (intLiteral 0) (int64Literal 1) - ,testRange 1002 A.Int64 (int64Literal 0) (intLiteral 1) - ,testRange 1003 A.Int (charLiteral 'a') (intLiteral 1) - ,testRange 1004 A.Int (intLiteral 0) (charLiteral 'b') + ,testRange 1000 A.Int32 (int32Literal 0) (int32Literal 1) + ,testRange 1001 A.Int64 (int32Literal 0) (int64Literal 1) + ,testRange 1002 A.Int64 (int64Literal 0) (int32Literal 1) + ,testRange 1003 A.Int32 (charLiteral 'a') (int32Literal 1) + ,testRange 1004 A.Int32 (int32Literal 0) (charLiteral 'b') ,testRange 1005 A.Int64 (charLiteral 'e') (int64Literal 1) ,testRange 1006 A.Int64 (int64Literal 0) (charLiteral 'f') ,testRange 1007 A.Byte (charLiteral 'd') (charLiteral 'f')