Rev | Line | |
---|
[19] | 1 | {-# LANGUAGE NoMonomorphismRestriction #-} |
---|
[20] | 2 | |
---|
[21] | 3 | module Tests.LambdaTest where |
---|
| 4 | |
---|
[19] | 5 | import Lambda |
---|
[21] | 6 | import Prelude ( ($), Int, (==), return, sequence, (>>=), and, (.), IO, Bool ) |
---|
| 7 | import qualified Control.Monad |
---|
[19] | 8 | |
---|
| 9 | test1 :: (Lambda l) => l Int |
---|
[24] | 10 | test1 = app (lam $ \_ -> lit 3) (lit 2) |
---|
[20] | 11 | |
---|
[21] | 12 | test1ast :: IO Bool |
---|
| 13 | test1ast = do |
---|
| 14 | t <- ast test1 |
---|
| 15 | return $ t "" == "(λa.3) 2" |
---|
[20] | 16 | |
---|
[21] | 17 | test1eval :: IO Bool |
---|
| 18 | test1eval = return $ eval test1 == 3 |
---|
| 19 | |
---|
| 20 | tests :: [IO Bool] |
---|
| 21 | tests = [ |
---|
| 22 | test1ast |
---|
| 23 | , test1eval |
---|
| 24 | ] |
---|
| 25 | |
---|
| 26 | runTests :: IO Bool |
---|
| 27 | runTests = Control.Monad.liftM and $ sequence tests |
---|
Note: See
TracBrowser
for help on using the repository browser.