Add euler examples as tests
This commit is contained in:
parent
cae6fef76d
commit
8e6929c0a9
2 changed files with 10 additions and 0 deletions
5
t/euler1.t
Normal file
5
t/euler1.t
Normal file
|
@ -0,0 +1,5 @@
|
|||
(defun range (start end)
|
||||
(do ((lst (list) (cons i lst)) (i start (+ 1 i))) ((= i end) lst)))
|
||||
|
||||
(let ((result (reduce + (filter (lambda (x) (or (zerop (mod x 3)) (zerop (mod x 5)))) (range 1 1000)))))
|
||||
(expect "euler1 - result is 233168" (= result 233168)))
|
5
t/euler2.t
Normal file
5
t/euler2.t
Normal file
|
@ -0,0 +1,5 @@
|
|||
(let ((result
|
||||
(do ((a 1 b) (b 2 (+ a b)) (sum 0)) ((> b 4000000) sum)
|
||||
(when (evenp b)
|
||||
(set sum (+ sum b))))))
|
||||
(expect "euler 2 - result is 4613732" (= result 4613732)))
|
Loading…
Reference in a new issue