Add recursion test
This commit is contained in:
parent
d35611b813
commit
59e7694dc0
1 changed files with 9 additions and 0 deletions
9
t/recursion.t
Normal file
9
t/recursion.t
Normal file
|
@ -0,0 +1,9 @@
|
|||
;; Factorial
|
||||
|
||||
(defun factorial (n)
|
||||
(if (> n 1)
|
||||
(* n (factorial (- n 1)))
|
||||
1))
|
||||
|
||||
(expect "Factorial of 5 is 120" (= (factorial 5) 120))
|
||||
(expect "Factorial of 1 is 1" (= (factorial 1) 1))
|
Loading…
Reference in a new issue