aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorColin Okay <cbeok@protonmail.com>2020-07-14 19:11:57 -0500
committerColin Okay <cbeok@protonmail.com>2020-07-14 19:11:57 -0500
commit72a6cd14e7111e8aa35556269f81309360baf03f (patch)
treead60fb2dc0d9a14908406a52d6adc65f71af36ac
parentd1d686fdb7c6a6f992e077acfb0a8e3fcb7ff68e (diff)
added a few tests
-rw-r--r--gtwiwtg-test.lisp43
1 files changed, 39 insertions, 4 deletions
diff --git a/gtwiwtg-test.lisp b/gtwiwtg-test.lisp
index c3aec34..7e25396 100644
--- a/gtwiwtg-test.lisp
+++ b/gtwiwtg-test.lisp
@@ -3,8 +3,43 @@
(in-package :gtwiwtg-test)
-(is (take 4 (range)) '(0 1 2 3))
-(is (collect (range :from 2 :to -1 :by -0.5))
- '(2.0 1.5 1.0 0.5 0.0 -0.5))
-(is ())
+(defmacro autoplan (&rest test-forms)
+ `(progn
+ (plan ,(length test-forms))
+ ,@test-forms
+ (finalize)))
+
+(autoplan
+
+ (is (take 4 (range)) '(0 1 2 3))
+
+
+ (is (collect (range :from 2 :to -1 :by -0.5))
+ '(2.0 1.5 1.0 0.5 0.0 -0.5))
+
+
+ (is (collect (range :from 2 :to -1 :by -0.5 :inclusive t))
+ '(2.0 1.5 1.0 0.5 0.0 -0.5 -1.0))
+
+ (ok (let ((r (range)))
+ (take 1 r)
+ (gtwiwtg::stopped-p r)))
+
+ (ok (not (gtwiwtg::stopped-p (range))))
+
+ (is '(4 5 6) (collect (seq '(1 2 3 4 5 6) :start 3)))
+
+ (is (collect (filter! (complement #'alpha-char-p) (seq "1234abcd5e6f")))
+ '(#\1 #\2 #\3 #\4 #\5 #\6))
+
+ (is '(1 2 3 5 8 13)
+ (take 6 (from-recurrence #'+ 1 0)))
+
+
+ (let ((s (open (asdf:system-source-file "gtwiwtg-test"))))
+ (size (from-input-stream s (lambda (s) (read-line s nil nil))))
+ (ok (not (open-stream-p s))))
+
+ )
+