From f5209b8f4c3c6f434c3643f7287e69d237d41f8d Mon Sep 17 00:00:00 2001 From: Ramakrishnan Muthukrishnan <vu3rdd@gmail.com> Date: Wed, 18 Jan 2012 07:41:21 +0530 Subject: [PATCH] add a factorial test --- TODO | 2 +- src/sicp/metacircular2-test.rkt | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/TODO b/TODO index 829d844..ee0aebd 100644 --- a/TODO +++ b/TODO @@ -1,7 +1,7 @@ * Things to do in chapter 2. - Work on 2.91 - 2.97 after working on 3.3.3 - run all the program which uses `get' and `put', after implementing - it in chapter 3. + it in chapter 3. diff --git a/src/sicp/metacircular2-test.rkt b/src/sicp/metacircular2-test.rkt index 91ea502..1644f95 100644 --- a/src/sicp/metacircular2-test.rkt +++ b/src/sicp/metacircular2-test.rkt @@ -71,7 +71,13 @@ b (fib-iter (+ a b) a (- count 1))))) env1) - (check-equal? (eval '(fib 10) env1) 55 "named let")))) + (check-equal? (eval '(fib 10) env1) 55 "named let") + (eval '(define (factorial n) + (if (= n 1) + 1 + (* (factorial (- n 1)) n))) + env1) + (check-equal? (eval '(factorial 10) env1) 3628800 "factorial test")))) (run-tests metacircular2-tests) \ No newline at end of file -- 2.45.2