From: Andrea Corallo Date: Mon, 9 Sep 2019 19:39:03 +0000 (+0200) Subject: add test for recursive calls X-Git-Tag: emacs-28.0.90~2727^2~1184 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=59035c17d08f0999ba96c74d1763eedb0347d11e;p=emacs.git add test for recursive calls --- diff --git a/test/src/comp-test-funcs.el b/test/src/comp-test-funcs.el index dbc90771774..e43db6973b7 100644 --- a/test/src/comp-test-funcs.el +++ b/test/src/comp-test-funcs.el @@ -221,6 +221,12 @@ (defun comp-tests-lambda-return-f () (lambda (x) (1+ x))) +(defun comp-tests-fib-f (n) + (cond ((= n 0) 0) + ((= n 1) 1) + (t (+ (comp-tests-fib-f (- n 1)) + (comp-tests-fib-f (- n 2)))))) + ;;;;;;;;;;;;;;;;;;;; ;; Tromey's tests ;; ;;;;;;;;;;;;;;;;;;;; diff --git a/test/src/comp-tests.el b/test/src/comp-tests.el index 4f4005bea66..16726cb4bbe 100644 --- a/test/src/comp-tests.el +++ b/test/src/comp-tests.el @@ -262,6 +262,9 @@ (ert-deftest comp-tests-lambda-return () (should (= (funcall (comp-tests-lambda-return-f) 3) 4))) +(ert-deftest comp-tests-recursive () + (should (= (comp-tests-fib-f 10) 55))) + ;;;;;;;;;;;;;;;;;;;; ;; Tromey's tests ;; ;;;;;;;;;;;;;;;;;;;;