Fix comment
[jscl.git] / tests / iter-macros.lisp
1 ; Tests for macros implementing iteration constructs
2 ; DOTIMES
3 (test (let ((total 0))
4         (dotimes (n 6)
5           (incf total n))
6         (= total 15)))
7
8 ; DOLIST
9 (test (let ((total 0))
10         (dolist (n '(1 2 3 4 5))
11           (incf total n))
12         (= total 15)))
13
14 ; DO
15 (test (do ((a 0 b)
16            (b 1 (+ a b))
17            (n 0 (1+ n)))
18         ((= n 10)
19          (= a 55))))
20 (test (= 5
21          (do (x) (t 5))))
22 (test (= 5
23          (do ((x)) (t 5))))
24 (test (= 5
25          (do ((x nil)) (t 5))))
26 (test (= 5
27          (do ((x nil nil)) (t 5))))
28
29 ; DO*
30 (test (do* ((a 0 b)
31             (b 1 (+ a b))
32             (n 0 (1+ n)))
33         ((= n 10)
34          (= a 512))))
35 (test (= 5
36          (do* (x) (t 5))))
37 (test (= 5
38          (do* ((x)) (t 5))))
39 (test (= 5
40          (do* ((x nil)) (t 5))))
41 (test (= 5
42          (do* ((x nil nil)) (t 5))))