summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--makefile2
-rw-r--r--test.hs61
2 files changed, 62 insertions, 1 deletions
diff --git a/makefile b/makefile
index 4388627..9b0cfea 100644
--- a/makefile
+++ b/makefile
@@ -18,7 +18,7 @@ distclean:
testprog:
- ghc --make test.hs -o ${OUTPUTDIR}/test
+ ghc -XDeriveDataTypeable --make test.hs -o ${OUTPUTDIR}/test
fractranprog:
ghc --make fractran.hs -o ${OUTPUTDIR}/fractran
diff --git a/test.hs b/test.hs
index 00dee93..94f575d 100644
--- a/test.hs
+++ b/test.hs
@@ -4,6 +4,8 @@ import Text.Parsec.Error
import Thue.Parser
import Fractran.Parser
+import Unlambda.Parser
+import Unlambda.Types
import Thue.Interpreter
import Fractran.Interpreter
import Fractran.Example
@@ -47,6 +49,60 @@ thueParser1 = TestCase (assertEqual ""
+unlambdaParser0 = TestCase (assertEqual ""
+ (Right S)
+ (parseUnlambda "s"))
+
+unlambdaParser1 = TestCase (assertEqual ""
+ (Right K)
+ (parseUnlambda "k"))
+
+unlambdaParser2 = TestCase (assertEqual ""
+ (Right I)
+ (parseUnlambda "i"))
+
+unlambdaParser3 = TestCase (assertEqual ""
+ (Right V)
+ (parseUnlambda "v"))
+
+unlambdaParser4 = TestCase (assertEqual ""
+ (Right R)
+ (parseUnlambda "r"))
+
+unlambdaParser5 = TestCase (assertEqual ""
+ (Right D)
+ (parseUnlambda "d"))
+
+unlambdaParser6 = TestCase (assertEqual ""
+ (Right C)
+ (parseUnlambda "c"))
+
+unlambdaParser7 = TestCase (assertEqual ""
+ (Right E)
+ (parseUnlambda "e"))
+
+unlambdaParser8 = TestCase (assertEqual ""
+ (Right (App S K))
+ (parseUnlambda "`sk"))
+
+unlambdaParser9 = TestCase (assertEqual ""
+ (Right (Dot 'c'))
+ (parseUnlambda ".c"))
+
+unlambdaParser10 = TestCase (assertEqual ""
+ (Right (Compare '?'))
+ (parseUnlambda "??"))
+
+unlambdaParser11 = TestCase (assertEqual ""
+ (Right Bar)
+ (parseUnlambda "|"))
+
+unlambdaParser12 = TestCase (assertEqual ""
+ (Right Reed)
+ (parseUnlambda "@"))
+
+
+
extractInfix0 = TestCase (assertEqual ""
Nothing
(extractInfix [1,2] [3,4,5]))
@@ -100,3 +156,8 @@ main = do
putStrLn "\nextractInfix"
runTestTT $ TestList [extractInfix0, extractInfix1, extractInfix2, extractInfix3, extractInfix4, extractInfix5]
+ putStrLn "\nUnlambda Parser"
+ runTestTT $ TestList [unlambdaParser0, unlambdaParser1, unlambdaParser2, unlambdaParser3, unlambdaParser4
+ ,unlambdaParser5, unlambdaParser6, unlambdaParser7, unlambdaParser8, unlambdaParser9
+ ,unlambdaParser10, unlambdaParser11, unlambdaParser12]
+