Commit 881e6f3d authored by pfdietz's avatar pfdietz

Added tests for make-two-way-stream, added comments to indicate which new...

Added tests for make-two-way-stream, added comments to indicate which new tests should be added for these and for broadcast and synonym streams.
parent f1f1f1b8
......@@ -39,5 +39,6 @@
(load "synonym-stream-symbol.lsp")
(load "make-broadcast-stream.lsp")
(load "broadcast-stream-streams.lsp")
(load "make-two-way-stream.lsp")
......@@ -7,6 +7,13 @@
(deftest make-broadcast-stream.1
(let ((s (make-broadcast-stream)))
(assert (typep s 'stream))
(assert (typep s 'broadcast-stream))
(assert (output-stream-p s))
(assert (not (input-stream-p s)))
(assert (open-stream-p s))
(assert (streamp s))
(assert (stream-element-type s))
(values
(notnot (typep s 'stream))
(notnot (typep s 'broadcast-stream))
......@@ -22,6 +29,10 @@
(assert (typep s 'stream))
(assert (typep s 'broadcast-stream))
(assert (output-stream-p s))
(assert (not (input-stream-p s)))
(assert (open-stream-p s))
(assert (streamp s))
(assert (stream-element-type s))
(write-char #\x s)))
"x")
......@@ -29,6 +40,13 @@
(let ((s1 (make-string-output-stream))
(s2 (make-string-output-stream)))
(let ((s (make-broadcast-stream s1 s2)))
(assert (typep s 'stream))
(assert (typep s 'broadcast-stream))
(assert (output-stream-p s))
(assert (not (input-stream-p s)))
(assert (open-stream-p s))
(assert (streamp s))
(assert (stream-element-type s))
(format s "This is a test"))
(values
(get-output-stream-string s1)
......@@ -36,6 +54,15 @@
"This is a test"
"This is a test")
;;; FIXME
;;; Add tests for: close, stream-element-type,
;;; 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, print, prin1 princ
;;; Error tests
(deftest make-broadcast-stream.error.1
(loop for x in *mini-universe*
unless (or (and (typep x 'stream) (output-stream-p x))
......
......@@ -47,6 +47,13 @@
(write-char #\y ss)))
"abxy")
;;; FIXME
;;; Add tests for: open-stream-p, close, stream-element-type, streamp,
;;; 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
;;; Error cases
(deftest make-synonym-stream.error.1
......
;-*- Mode: Lisp -*-
;;;; Author: Paul Dietz
;;;; Created: Fri Jan 30 05:39:56 2004
;;;; Contains: Tests for MAKE-TWO-WAY-STREAM
(in-package :cl-test)
(deftest make-two-way-stream.1
(let* ((is (make-string-input-stream "foo"))
(os (make-string-output-stream))
(s (make-two-way-stream is os)))
(assert (typep s 'stream))
(assert (typep s 'two-way-stream))
(assert (streamp s))
(assert (open-stream-p s))
(assert (input-stream-p s))
(assert (output-stream-p s))
(assert (stream-element-type s))
(values
(read-char s)
(write-char #\b s)
(read-char s)
(write-char #\a s)
(read-char s)
(write-char #\r s)
(get-output-stream-string os)))
#\f #\b #\o #\a #\o #\r "bar")
;;; FIXME
;;; Add tests for: close, stream-element-type,
;;; 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
;;; Error tests
(deftest make-two-way-stream.error.1
(signals-error (make-two-way-stream) program-error)
t)
(deftest make-two-way-stream.error.2
(signals-error (make-two-way-stream (make-string-input-stream "foo"))
program-error)
t)
(deftest make-two-way-stream.error.3
(signals-error (let ((os (make-string-output-stream)))
(make-two-way-stream (make-string-input-stream "foo")
os nil))
program-error)
t)
(deftest make-two-way-stream.error.4
(loop for x in *mini-universe*
unless (or (and (typep x 'stream) (input-stream-p x))
(eval `(signals-error
(let ((os (make-string-output-stream)))
(make-two-way-stream ',x os))
type-error)))
collect x)
nil)
(deftest make-two-way-stream.error.5
(loop for x in *streams*
unless (or (and (typep x 'stream) (input-stream-p x))
(eval `(signals-error
(let ((os (make-string-output-stream)))
(make-two-way-stream ',x os))
type-error)))
collect x)
nil)
(deftest make-two-way-stream.error.6
(loop for x in *mini-universe*
unless (or (and (typep x 'stream) (output-stream-p x))
(eval `(signals-error
(let ((is (make-string-input-stream "foo")))
(make-two-way-stream is ',x))
type-error)))
collect x)
nil)
(deftest make-two-way-stream.error.7
(loop for x in *streams*
unless (or (and (typep x 'stream) (output-stream-p x))
(eval `(signals-error
(let ((is (make-string-input-stream "foo")))
(make-two-way-stream is ',x))
type-error)))
collect x)
nil)
\ No newline at end of file
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