simple-vector-p.lsp 1.49 KB
Newer Older
pfdietz's avatar
pfdietz committed
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
;-*- Mode:     Lisp -*-
;;;; Author:   Paul Dietz
;;;; Created:  Wed Jan 22 21:23:45 2003
;;;; Contains: Tests for SIMPLE-VECTOR-P

(in-package :cl-test)

;;; More tests for this are in make-array.lsp

(deftest simple-vector-p.1
  (loop for e in *universe*
	unless (if (typep e 'simple-vector)
		   (simple-vector-p e)
		 (not (simple-vector-p e)))
	collect e)
  nil)

(deftest simple-vector-p.2
  (notnot (simple-vector-p (make-array '(10))))
  t)

(deftest simple-vector-p.3
  (simple-vector-p (make-array '(5) :fill-pointer t))
  nil)

(deftest simple-vector-p.4
  (notnot (simple-vector-p (vector 'a 'b 'c)))
  t)

(deftest simple-vector-p.5
  (simple-vector-p (make-array '(5) :adjustable t))
  nil)

(deftest simple-vector-p.6
  (let ((a #(a b c d e g h)))
    (simple-vector-p (make-array '(5) :displaced-to a)))
  nil)

(deftest simple-vector-p.7
  (simple-vector-p #*001101)
  nil)

(deftest simple-vector-p.8
  (simple-vector-p "abcdef")
  nil)

(deftest simple-vector-p.9
  (simple-vector-p (make-array nil))
  nil)

(deftest simple-vector-p.10
  (simple-vector-p (make-array '(10) :element-type 'base-char))
  nil)

(deftest simple-vector-p.11
  (simple-vector-p (make-array '(10) :element-type 'character))
  nil)

(deftest simple-vector-p.12
  (simple-vector-p (make-array '(10) :element-type 'bit))
  nil)

;;; Error tests

(deftest simple-vector-p.error.1
  (classify-error (simple-vector-p))
  program-error)

(deftest simple-vector-p.error.2
  (classify-error (simple-vector-p #(a b) nil))
  program-error)