summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJed Barber <jjbarber@y7mail.com>2014-03-24 00:59:37 +1100
committerJed Barber <jjbarber@y7mail.com>2014-03-24 00:59:37 +1100
commit7e8cd0e859e41bf7ce8942997367e1cf82bddf80 (patch)
tree2ac539bbd7adb2d2c49f151956997d83eb94675c
parent8dbe6cd9102211f7b5a265c7209685c4aa026fb6 (diff)
Interpreter tests for d
-rw-r--r--Unlambda/Test.hs31
1 files changed, 20 insertions, 11 deletions
diff --git a/Unlambda/Test.hs b/Unlambda/Test.hs
index 504ae07..f049b59 100644
--- a/Unlambda/Test.hs
+++ b/Unlambda/Test.hs
@@ -50,23 +50,30 @@ parser12 = (Right Reed) ~=? (parseUnlambda "@")
interpretString :: String -> IO (Maybe (String,UnlambdaTerm))
interpretString input =
- let t = parseUnlambda input
- in case t of
- Left _ -> return Nothing
- Right term -> do
- c <- capture (unlambda term)
- return (Just c)
+ let t = parseUnlambda input
+ in case t of
+ Left _ -> return Nothing
+ Right term -> do
+ c <- capture (unlambda term)
+ return (Just c)
interpreter0 = (liftM2 (~=?))
- (return (Just ("\n",R)) )
+ (return (Just ("\n", R)) )
(interpretString "``cir")
interpreter1 = (liftM2 (~=?))
- (return (Just ("",I)) )
+ (return (Just ("", I)) )
(interpretString "`c``s`kr``si`ki")
+interpreter2 = (liftM2 (~=?))
+ (return (Just ("", Promise (App R I))) )
+ (interpretString "`d`ri")
+
+interpreter3 = (liftM2 (~=?))
+ (return (Just ("\n", Promise I)) )
+ (interpretString "``dd`ri")
@@ -78,9 +85,11 @@ parserTests = TestList [parser0, parser1, parser2, parser3, parser4, parser5, pa
interpreterTests :: IO Test
interpreterTests = do
- t0 <- interpreter0
- t1 <- interpreter1
- return (TestList [t0,t1])
+ t0 <- interpreter0
+ t1 <- interpreter1
+ t2 <- interpreter2
+ t3 <- interpreter3
+ return (TestList [t0,t1,t2,t3])