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 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97
|
;-*- Mode: Lisp -*-
;;;; Author: Paul Dietz
;;;; Created: Sun Aug 29 17:32:20 2004
;;;; Contains: Tests of STRINGP
(in-package :cl-test)
(deftest stringp.1
(check-type-predicate #'stringp 'string)
nil)
(deftest stringp.2
(notnot (stringp "abcd"))
t)
(deftest stringp.3
(notnot (stringp (make-array 4 :element-type 'character
:initial-contents '(#\a #\b #\c #\d))))
t)
(deftest stringp.4
(notnot (stringp (make-array 4 :element-type 'base-char
:initial-contents '(#\a #\b #\c #\d))))
t)
(deftest stringp.5
(notnot (stringp (make-array 4 :element-type 'standard-char
:initial-contents '(#\a #\b #\c #\d))))
t)
(deftest stringp.6
(stringp 0)
nil)
(deftest stringp.7
(stringp #\a)
nil)
(deftest stringp.8
(let* ((s (make-array 10 :element-type 'character
:initial-element #\a))
(s2 (make-array 4 :element-type 'character
:displaced-to s
:displaced-index-offset 2)))
(notnot (stringp s2)))
t)
(deftest stringp.9
:notes (:nil-vectors-are-strings)
(notnot-mv (stringp (make-array '(0) :element-type nil)))
t)
(deftest stringp.10
:notes (:nil-vectors-are-strings)
(notnot-mv (stringp (make-array '(37) :element-type nil)))
t)
(deftest stringp.11
(notnot (stringp (make-array 4 :element-type 'base-char
:fill-pointer 2
:initial-contents '(#\a #\b #\c #\d))))
t)
(deftest stringp.12
(notnot (stringp (make-array 4 :element-type 'base-char
:adjustable t
:initial-contents '(#\a #\b #\c #\d))))
t)
(deftest stringp.13
(notnot (stringp (make-array 4 :element-type 'character
:fill-pointer 2
:initial-contents '(#\a #\b #\c #\d))))
t)
(deftest stringp.14
(notnot (stringp (make-array 4 :element-type 'character
:adjustable t
:initial-contents '(#\a #\b #\c #\d))))
t)
(deftest stringp.15
(let ((i 0))
(values
(notnot (stringp (progn (incf i) "")))
i))
t 1)
;;; Error tests
(deftest stringp.error.1
(signals-error (stringp) program-error)
t)
(deftest stringp.error.2
(signals-error (stringp "" nil) program-error)
t)
|