Update lispytest.py

This commit is contained in:
Peter Norvig authored and GitHub committed 2018-10-24 14:47:50 -07:00
1 parent 21fb7b98c8
commit 5bda69ee24
1 file changed
+1 -1
+1 -1
View File
@@ -9,7 +9,6 @@ lis_tests = [
("(if (> 6 5) (+ 1 1) (+ 2 2))", 2), ("(if (> 6 5) (+ 1 1) (+ 2 2))", 2),
("(if (< 6 5) (+ 1 1) (+ 2 2))", 4), ("(if (< 6 5) (+ 1 1) (+ 2 2))", 4),
("(define x 3)", None), ("x", 3), ("(+ x x)", 6), ("(define x 3)", None), ("x", 3), ("(+ x x)", 6),
("(begin (define x 1) (set! x (+ x 1)) (+ x 1))", 3),
("((lambda (x) (+ x x)) 5)", 10), ("((lambda (x) (+ x x)) 5)", 10),
("(define twice (lambda (x) (* 2 x)))", None), ("(twice 5)", 10), ("(define twice (lambda (x) (* 2 x)))", None), ("(twice 5)", 10),
("(define compose (lambda (f g) (lambda (x) (f (g x)))))", None), ("(define compose (lambda (f g) (lambda (x) (f (g x)))))", None),
@@ -51,6 +50,7 @@ lispy_tests = [
("(lyst 1 2 3 (+ 2 2))", [1,2,3,4]), ("(lyst 1 2 3 (+ 2 2))", [1,2,3,4]),
("(if 1 2)", 2), ("(if 1 2)", 2),
("(if (= 3 4) 2)", None), ("(if (= 3 4) 2)", None),
("(begin (define x 1) (set! x (+ x 1)) (+ x 1))", 3),
("(define ((account bal) amt) (set! bal (+ bal amt)) bal)", None), ("(define ((account bal) amt) (set! bal (+ bal amt)) bal)", None),
("(define a1 (account 100))", None), ("(define a1 (account 100))", None),
("(a1 0)", 100), ("(a1 10)", 110), ("(a1 10)", 120), ("(a1 0)", 100), ("(a1 10)", 110), ("(a1 10)", 120),