blob: 7e25396ec68778b5eb4f790d837d352d631ae41a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
(defpackage :gtwiwtg-test
(:use :cl :gtwiwtg :prove))
(in-package :gtwiwtg-test)
(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))))
)
|