Rev | Line | |
---|
[21] | 1 | {-# LANGUAGE NoMonomorphismRestriction #-} |
---|
| 2 | |
---|
| 3 | module Tests.OpsTest where |
---|
| 4 | |
---|
| 5 | import Ops |
---|
| 6 | import Lambda |
---|
| 7 | import Prelude ( ($), Int, (==), return, sequence, (>>=), and, (.), IO, Bool ) |
---|
| 8 | import qualified Control.Monad |
---|
| 9 | |
---|
| 10 | test1 :: (LOps l) => l Int |
---|
| 11 | test1 = app (lam $ \x -> const 3 + x) (const 2) |
---|
| 12 | |
---|
| 13 | test1ast :: IO Bool |
---|
| 14 | test1ast = do |
---|
| 15 | t <- ast test1 |
---|
| 16 | return $ t "" == "(λa.3+a) 2" |
---|
| 17 | test1eval :: IO Bool |
---|
| 18 | test1eval = return $ eval test1 == 5 |
---|
| 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.