Commit 2255509d authored by pfdietz's avatar pfdietz

Added a file containing spec issues that have arisen in the writing

of the test suite (this file is incomplete).

More TODOs.

Added more two-way-stream tests.
parent f3d2ee25
This file contains notes on problems in the ANSI CL spec found
during the construction of the tests.
1. When building a composite stream, what happens when the component
streams have different element types?
2. Should there be an UPGRADED-STREAM-ELEMENT-TYPE function.
3. The spec requires that arrays specialized to type NIL exist.
Was this intended?
4. If NIL specialized arrays exist, then NIL vectors are also strings.
Was this intended?
5. The spec requires that (UPGRADED-COMPLEX-PART-TYPE NIL) be (type
equivalent to) NIL.
6. The definition of UPGRADED-COMPLEX-PART-TYPE appears to require that
it work on arbitrary typespecs, including SATISFIES, which is not
possible.
......@@ -12,9 +12,14 @@ Things to do to the test suite (not a complete list)
6. adjust-array
7. Address broadcast-stream issues (from Duane Rettig)
7. Address synonym-stream issues (from Duane Rettig)
8. accuracy tests for numeric functions
9. Test that the streams operators that manipulate files
do the right things with *default-pathname-defaults*.
10. Two-arg tests of FILE-POSITION on binary streams.
11. Address issues with broadcast streams (C. Rhodes) -- apparent
contradictions in the spec
\ No newline at end of file
......@@ -39,12 +39,165 @@
(get-output-stream-string os)))
t nil t t #\8 "8")
;;; FIXME
;;; Add tests for:
;;; peek-char, read-char-no-hang, terpri, fresh-line, unread-char,
;;; read-line, write-line, write-string, read-sequence, write-sequence,
;;; read-byte, write-byte, listen, clear-input, finish-output, force-output,
;;; clear-output, format, print, prin1, princ
(deftest make-two-way-stream.3
(let* ((is (make-string-input-stream "foo"))
(os (make-string-output-stream))
(s (make-two-way-stream is os)))
(values
(peek-char nil s)
(read-char s)
(get-output-stream-string os)))
#\f #\f "")
(deftest make-two-way-stream.4
(let* ((is (make-string-input-stream "foo"))
(os (make-string-output-stream))
(s (make-two-way-stream is os)))
(values
(read-char-no-hang s)
(read-char-no-hang s nil)
(read-char-no-hang s t :eof)
(read-char-no-hang s nil :eof)
(get-output-stream-string os)))
#\f #\o #\o :eof "")
(deftest make-two-way-stream.5
(let* ((is (make-string-input-stream "foo"))
(os (make-string-output-stream))
(s (make-two-way-stream is os)))
(values
(terpri s)
(get-output-stream-string os)))
nil #.(string #\Newline))
(deftest make-two-way-stream.6
(let* ((is (make-string-input-stream "foo"))
(os (make-string-output-stream))
(s (make-two-way-stream is os)))
(values
(write-char #\+ s)
(notnot (fresh-line s))
(read-char s)
(get-output-stream-string os)))
#\+ t #\f #.(coerce (list #\+ #\Newline) 'string))
(deftest make-two-way-stream.7
(let* ((is (make-string-input-stream "foo"))
(os (make-string-output-stream))
(s (make-two-way-stream is os)))
(values
(read-char s)
(unread-char #\f s)
(read-char s)
(read-char s)
(unread-char #\o s)
(get-output-stream-string os)))
#\f nil #\f #\o nil "")
(deftest make-two-way-stream.8
(let* ((is (make-string-input-stream "foo"))
(os (make-string-output-stream))
(s (make-two-way-stream is os)))
(values
(read-line s)
(get-output-stream-string os)))
"foo" "")
(deftest make-two-way-stream.9
(let* ((is (make-string-input-stream "foo"))
(os (make-string-output-stream))
(s (make-two-way-stream is os)))
(values
(write-string "bar" s)
(get-output-stream-string os)))
"bar" "bar")
(deftest make-two-way-stream.10
(let* ((is (make-string-input-stream "foo"))
(os (make-string-output-stream))
(s (make-two-way-stream is os)))
(values
(write-line "bar" s)
(get-output-stream-string os)))
"bar" #.(concatenate 'string "bar" '(#\Newline)))
(deftest make-two-way-stream.11
(let* ((is (make-string-input-stream "foo"))
(os (make-string-output-stream))
(s (make-two-way-stream is os)))
(let ((x (vector nil nil nil)))
(values
(read-sequence x s)
x
(get-output-stream-string os))))
3 #(#\f #\o #\o) "")
(deftest make-two-way-stream.12
(let ((pn1 #p"tmp.dat")
(pn2 #p"tmp2.dat")
(element-type '(unsigned-byte 8)))
(with-open-file (s pn1 :direction :output :if-exists :supersede
:element-type element-type)
(dolist (b '(3 8 19 41)) (write-byte b s)))
(with-open-file
(is pn1 :direction :input :element-type element-type)
(with-open-file
(os pn2 :direction :output :element-type element-type
:if-exists :supersede)
(let ((s (make-two-way-stream is os))
(x (vector nil nil nil nil)))
(assert (eql (read-sequence x s) 4))
(assert (equalp x #(3 8 19 41)))
(let ((y #(100 5 18 211 0 178)))
(assert (eql (write-sequence y s) y))
(close s)))))
(with-open-file
(s pn2 :direction :input :element-type element-type)
(let ((x (vector nil nil nil nil nil nil nil)))
(values
(read-sequence x s)
x))))
6
#(100 5 18 211 0 178 nil))
(deftest make-two-way-stream.13
(let ((pn1 #p"tmp.dat")
(pn2 #p"tmp2.dat")
(element-type '(unsigned-byte 32)))
(with-open-file (s pn1 :direction :output :if-exists :supersede
:element-type element-type)
(dolist (b '(3 8 19 41)) (write-byte b s)))
(with-open-file
(is pn1 :direction :input :element-type element-type)
(with-open-file
(os pn2 :direction :output :element-type element-type
:if-exists :supersede)
(let ((s (make-two-way-stream is os))
(x (vector nil nil nil nil)))
(assert (eql (read-sequence x s) 4))
(assert (equalp x #(3 8 19 41)))
(let ((y #(100 5 18 211 0 178)))
(assert (eql (write-sequence y s) y))
(close s)))))
(with-open-file
(s pn2 :direction :input :element-type element-type)
(let ((x (vector nil nil nil nil nil nil nil)))
(values
(read-sequence x s)
x))))
6
#(100 5 18 211 0 178 nil))
(deftest make-two-way-stream.14
(let* ((is (make-string-input-stream "foo"))
(os (make-string-output-stream))
(s (make-two-way-stream is os)))
(values
(write-string "abc" s)
(clear-input s)
(write-string "def" s)
(get-output-stream-string os)))
"abc" nil "def" "abcdef")
;;; Error tests
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment