Add a few basic tests for iteration constructs
authorStrigoides <Strigoides@gmail.com>
Fri, 26 Apr 2013 12:17:56 +0000 (00:17 +1200)
committerStrigoides <Strigoides@gmail.com>
Fri, 26 Apr 2013 12:17:56 +0000 (00:17 +1200)
tests/iter-macros.lisp [new file with mode: 0644]

diff --git a/tests/iter-macros.lisp b/tests/iter-macros.lisp
new file mode 100644 (file)
index 0000000..d1e9ca3
--- /dev/null
@@ -0,0 +1,19 @@
+; Tests for macros implementing iteration constructs
+; DOTIMES
+(test (let ((total 0))
+        (dotimes (n 6)
+          (incf total n))
+        (= total 15)))
+
+; DOLIST
+(test (let ((total 0))
+        (dolist (n '(1 2 3 4 5))
+          (incf total n))
+        (= total 15)))
+
+; DO
+(test (do ((a 0 b)                                 
+           (b 1 (+ a b))                                                          
+           (n 0 (1+ n)))                                                          
+        ((= n 10) 
+         (= a 55))))