Add a test for equality
[scheme.git] / tests.scm
index a198dd4ac5a00e4cd71e9a88f8ae32eefbca994c..f078229dd6364f78ac5769341f8f53b8d3edad27 100644 (file)
--- a/tests.scm
+++ b/tests.scm
                    bar))
            '(abs a a))
 
+(test-types (typecheck '(let ([foo 3]
+                             [bar (+ foo baz)]
+                             [baz (- bar 1)])
+                         bar))
+           'int)
+
+(test-types (typecheck '(let ([foo 3]
+                             [bar (baz foo)]
+                             [baz (lambda (x) x)])
+                         baz))
+           '(abs a a))
+
+(test-types (typecheck '(let ([foo 3]
+                             [bar (baz foo)]
+                             [baz (lambda (x) x)])
+                         bar))
+           'int)
+
 (test-prog '(+ 1 2) 3)
+(test-prog '(bool->int (= 2 0)) 0)
 (test-prog '((lambda (x) ((lambda (y) (+ x y)) 42)) 100) 142)
 
 (test-prog '(* 10 5) 50)