From 67aea6bcfa4a81d75b9c20f05c7e070a157ff58b Mon Sep 17 00:00:00 2001 From: pfdietz <pfdietz@localhost> Date: Wed, 21 Apr 2004 04:24:21 +0000 Subject: [PATCH] More vector printing tests --- ansi-tests/print-vector.lsp | 45 ++++++++++++++++++++++++++++++++++--- 1 file changed, 42 insertions(+), 3 deletions(-) diff --git a/ansi-tests/print-vector.lsp b/ansi-tests/print-vector.lsp index 80866fe1..dd11abda 100644 --- a/ansi-tests/print-vector.lsp +++ b/ansi-tests/print-vector.lsp @@ -5,6 +5,8 @@ (in-package :cl-test) +;;; Empty vector tests + (deftest print.vector.1 (with-standard-io-syntax (write-to-string #() :readably nil :array t)) @@ -14,7 +16,7 @@ (with-standard-io-syntax (loop for i from 2 to 100 for a = (make-array '(0) :element-type `(unsigned-byte ,i)) - for s = (write-to-string a :readably nil :array t) + for s = (write-to-string a :readably nil :array t :pretty nil) unless (string= s "#()") collect (list i s))) nil) @@ -23,7 +25,7 @@ (with-standard-io-syntax (loop for i from 1 to 100 for a = (make-array '(0) :element-type `(signed-byte ,i)) - for s = (write-to-string a :readably nil :array t) + for s = (write-to-string a :readably nil :array t :pretty nil) unless (string= s "#()") collect (list i s))) nil) @@ -32,7 +34,44 @@ (with-standard-io-syntax (loop for type in '(short-float single-float double-float long-float) for a = (make-array '(0) :element-type type) - for s = (write-to-string a :readably nil :array t) + for s = (write-to-string a :readably nil :array t :pretty nil) unless (string= s "#()") collect (list type s))) nil) + +;;; Nonempty vectors + +(deftest print.vector.5 + (with-standard-io-syntax + (let* ((*package* (find-package "CL-TEST")) + (result + (write-to-string #(a b c) + :readably nil :array t + :pretty nil :case :downcase))) + (or (and (string= result "#(a b c)") t) + result))) + t) + +(deftest print.vector.6 + (with-standard-io-syntax + (loop + for i from 2 to 100 + for a = (make-array '(4) :element-type `(unsigned-byte ,i) + :initial-contents '(3 0 2 1)) + for s = (write-to-string a :readably nil :array t :pretty nil) + unless (string= s "#(3 0 2 1)") + collect (list i a s))) + nil) + +(deftest print.vector.7 + (with-standard-io-syntax + (loop + for i from 2 to 100 + for a = (make-array '(4) :element-type `(signed-byte ,i) + :initial-contents '(-2 -1 0 1)) + for s = (write-to-string a :readably nil :array t :pretty nil) + unless (string= s "#(-2 -1 0 1)") + collect (list i a s))) + nil) + + -- GitLab