summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJed Barber <jjbarber@y7mail.com>2014-03-19 11:16:00 +1100
committerJed Barber <jjbarber@y7mail.com>2014-03-19 11:16:00 +1100
commit6a5acf36e6764c47da526f2980edfef42ae6f59a (patch)
tree3ca7319b6526ca8589b45395117e4d34aa6847ee
parent0ca67c7536c8ab158c6271d8d72e9786f0e0652b (diff)
More concise test case statements
-rw-r--r--Fractran/Test.hs32
-rw-r--r--Thue/Test.hs32
-rw-r--r--Unlambda/Test.hs52
3 files changed, 29 insertions, 87 deletions
diff --git a/Fractran/Test.hs b/Fractran/Test.hs
index 80f5424..2b507b1 100644
--- a/Fractran/Test.hs
+++ b/Fractran/Test.hs
@@ -17,39 +17,23 @@ instance Eq Text.Parsec.Error.ParseError
-parser0 = TestCase (assertEqual ""
- (Right (FractranProgram [] 2))
- (parseFractran "2"))
+parser0 = (Right (FractranProgram [] 2)) ~=? (parseFractran "2")
-parser1 = TestCase (assertEqual ""
- (Right (FractranProgram [] 2))
- (parseFractran "2\n"))
+parser1 = (Right (FractranProgram [] 2)) ~=? (parseFractran "2\n")
-parser2 = TestCase (assertEqual ""
- (Right (FractranProgram [] 2))
- (parseFractran "\n2"))
+parser2 = (Right (FractranProgram [] 2)) ~=? (parseFractran "\n2")
-parser3 = TestCase (assertEqual ""
- (Right (FractranProgram [(1,2)] 2))
- (parseFractran "2 1/2"))
+parser3 = (Right (FractranProgram [(1,2)] 2)) ~=? (parseFractran "2 1/2")
-parser4 = TestCase (assertEqual ""
- (Right (FractranProgram [(2,3)] 3))
- (parseFractran "3\n \n2/3\n"))
+parser4 = (Right (FractranProgram [(2,3)] 3)) ~=? (parseFractran "3\n \n2/3\n")
-interpreter0 = TestCase (assertEqual ""
- [108,162,243]
- (fractran (FractranProgram addition 108)))
+interpreter0 = [108,162,243] ~=? (fractran (FractranProgram addition 108))
-interpreter1 = TestCase (assertEqual ""
- [2,15,825,725,1925,2275,425,390,330,290,770,910,170,156,132,116,308,364,68,4]
- (take 20 (fractran prime2)))
+interpreter1 = [2,15,825,725,1925,2275,425,390,330,290,770,910,170,156,132,116,308,364,68,4] ~=? (take 20 (fractran prime2))
-interpreter2 = TestCase (assertEqual ""
- [5]
- (fractran (FractranProgram addition 5)))
+interpreter2 = [5] ~=? (fractran (FractranProgram addition 5))
diff --git a/Thue/Test.hs b/Thue/Test.hs
index 2e30f6b..0273c48 100644
--- a/Thue/Test.hs
+++ b/Thue/Test.hs
@@ -16,39 +16,23 @@ instance Eq Text.Parsec.Error.ParseError
-parser0 = TestCase (assertEqual ""
- (Right (ThueProgram [ThueRule "a" "b"] "a"))
- (parseThue "a::=b\n::=\na"))
+parser0 = (Right (ThueProgram [ThueRule "a" "b"] "a")) ~=? (parseThue "a::=b\n::=\na")
-parser1 = TestCase (assertEqual ""
- (Right (ThueProgram [] "b"))
- (parseThue "::=\nb"))
+parser1 = (Right (ThueProgram [] "b")) ~=? (parseThue "::=\nb")
-extractInfix0 = TestCase (assertEqual ""
- Nothing
- (extractInfix [1,2] [3,4,5]))
+extractInfix0 = Nothing ~=? (extractInfix [1,2] [3,4,5])
-extractInfix1 = TestCase (assertEqual ""
- (Just ([1,2],[5,6]))
- (extractInfix [3,4] [1,2,3,4,5,6]))
+extractInfix1 = (Just ([1,2],[5,6])) ~=? (extractInfix [3,4] [1,2,3,4,5,6])
-extractInfix2 = TestCase (assertEqual ""
- (Just ([],[3,4]))
- (extractInfix [0,1,2] [0,1,2,3,4]))
+extractInfix2 = (Just ([],[3,4])) ~=? (extractInfix [0,1,2] [0,1,2,3,4])
-extractInfix3 = TestCase (assertEqual ""
- (Just ([1],[]))
- (extractInfix [2,3] [1,2,3]))
+extractInfix3 = (Just ([1],[])) ~=? (extractInfix [2,3] [1,2,3])
-extractInfix4 = TestCase (assertEqual ""
- (Just ([],[1]))
- (extractInfix [] [1]))
+extractInfix4 = (Just ([],[1])) ~=? (extractInfix [] [1])
-extractInfix5 = TestCase (assertEqual ""
- (Just ("before","after"))
- (extractInfix "middle" "beforemiddleafter"))
+extractInfix5 = (Just ("before","after")) ~=? (extractInfix "middle" "beforemiddleafter")
diff --git a/Unlambda/Test.hs b/Unlambda/Test.hs
index 7d1da1e..9c0024c 100644
--- a/Unlambda/Test.hs
+++ b/Unlambda/Test.hs
@@ -16,57 +16,31 @@ instance Eq Text.Parsec.Error.ParseError
-parser0 = TestCase (assertEqual ""
- (Right S)
- (parseUnlambda "s"))
+parser0 = (Right S) ~=? (parseUnlambda "s")
-parser1 = TestCase (assertEqual ""
- (Right K)
- (parseUnlambda "k"))
+parser1 = (Right K) ~=? (parseUnlambda "k")
-parser2 = TestCase (assertEqual ""
- (Right I)
- (parseUnlambda "i"))
+parser2 = (Right I) ~=? (parseUnlambda "i")
-parser3 = TestCase (assertEqual ""
- (Right V)
- (parseUnlambda "v"))
+parser3 = (Right V) ~=? (parseUnlambda "v")
-parser4 = TestCase (assertEqual ""
- (Right R)
- (parseUnlambda "r"))
+parser4 = (Right R) ~=? (parseUnlambda "r")
-parser5 = TestCase (assertEqual ""
- (Right D)
- (parseUnlambda "d"))
+parser5 = (Right D) ~=? (parseUnlambda "d")
-parser6 = TestCase (assertEqual ""
- (Right C)
- (parseUnlambda "c"))
+parser6 = (Right C) ~=? (parseUnlambda "c")
-parser7 = TestCase (assertEqual ""
- (Right E)
- (parseUnlambda "e"))
+parser7 = (Right E) ~=? (parseUnlambda "e")
-parser8 = TestCase (assertEqual ""
- (Right (App S K))
- (parseUnlambda "`sk"))
+parser8 = (Right (App S K)) ~=? (parseUnlambda "`sk")
-parser9 = TestCase (assertEqual ""
- (Right (Dot 'c'))
- (parseUnlambda ".c"))
+parser9 = (Right (Dot 'c')) ~=? (parseUnlambda ".c")
-parser10 = TestCase (assertEqual ""
- (Right (Compare '?'))
- (parseUnlambda "??"))
+parser10 = (Right (Compare '?')) ~=? (parseUnlambda "??")
-parser11 = TestCase (assertEqual ""
- (Right Bar)
- (parseUnlambda "|"))
+parser11 = (Right Bar) ~=? (parseUnlambda "|")
-parser12 = TestCase (assertEqual ""
- (Right Reed)
- (parseUnlambda "@"))
+parser12 = (Right Reed) ~=? (parseUnlambda "@")