-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtest.lisp
33 lines (27 loc) · 912 Bytes
/
test.lisp
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
(defpackage :cl-plumbing-test
(:use :cl :cl-plumbing :stefil :iterate)
(:export))
(in-package :cl-plumbing-test)
(in-root-suite)
(deftest iterate-test ()
"Test to see if the pipes work with Iterates in-stream driver."
(let ((pipe (make-pipe)))
(print 1 pipe)
(print 2 pipe)
(print 3 pipe)
(is (equal '(1 2 3)
(iter (for val in-stream pipe)
(collect val))))))
(deftest pipe-test ()
(let ((input "hello howdy heck"))
(let ((pipe (make-pipe)))
(iter (for c in-sequence input)
(write-char c pipe)
(is (equal c (read-char pipe)))))
(is (equal input
(let ((pipe (make-pipe)))
(iter (for c in-sequence input)
(write-char c pipe))
(iter (for c = (read-char pipe nil nil))
(while c)
(collect c result-type 'string)))))))