simple-string-p.lsp 1.85 KB
Newer Older
pfdietz's avatar
pfdietz committed
1 2 3 4 5 6 7 8
;-*- Mode:     Lisp -*-
;;;; Author:   Paul Dietz
;;;; Created:  Sun Aug 29 17:31:24 2004
;;;; Contains: Tests of SIMPLE-STRING-P

(in-package :cl-test)

(deftest simple-string-p.1
9 10
  (check-type-predicate #'simple-string-p 'simple-string)
  nil)
pfdietz's avatar
pfdietz committed
11 12 13 14 15 16 17 18 19

(deftest simple-string-p.2
  (notnot-mv (simple-string-p "ancd"))
  t)

(deftest simple-string-p.3
  (simple-string-p 0)
  nil)

20 21
;;; (deftest simple-string-p.4
;;;  (simple-string-p (make-array 4 :element-type 'character
sds's avatar
sds committed
22 23
;;;                            :initial-contents '(#\a #\a #\a #\b)
;;;                            :fill-pointer t))
24
;;;  nil)
pfdietz's avatar
pfdietz committed
25 26 27 28

(deftest simple-string-p.5
  (notnot-mv
   (simple-string-p (make-array
sds's avatar
sds committed
29 30
                     4 :element-type 'base-char
                     :initial-contents '(#\a #\a #\a #\b))))
pfdietz's avatar
pfdietz committed
31 32 33 34 35
  t)

(deftest simple-string-p.6
  (notnot-mv
   (simple-string-p (make-array
sds's avatar
sds committed
36 37
                     4 :element-type 'standard-char
                     :initial-contents '(#\a #\a #\a #\b))))
pfdietz's avatar
pfdietz committed
38 39
  t)

40 41
;;; (deftest simple-string-p.7
;;;  (let* ((s (make-array 10 :element-type 'character
sds's avatar
sds committed
42 43 44 45
;;;                     :initial-element #\a))
;;;      (s2 (make-array 4 :element-type 'character
;;;                      :displaced-to s
;;;                      :displaced-index-offset 2)))
46 47
;;;    (simple-string-p s2))
;;;  nil)
pfdietz's avatar
pfdietz committed
48 49 50 51 52 53 54 55 56 57

(deftest simple-string-p.8
  :notes (:nil-vectors-are-strings)
  (notnot-mv (simple-string-p (make-array '(0) :element-type nil)))
  t)

(deftest simple-string-p.9
  :notes (:nil-vectors-are-strings)
  (notnot-mv (simple-string-p (make-array '(37) :element-type nil)))
  t)
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74

(deftest simple-string-p.10
  (let ((i 0))
    (values
     (notnot (simple-string-p (progn (incf i) "")))
     i))
  t 1)

;;; Error tests

(deftest simple-string-p.error.1
  (signals-error (simple-string-p) program-error)
  t)

(deftest simple-string-p.error.2
  (signals-error (simple-string-p "" nil) program-error)
  t)