arrayp.lsp 920 Bytes
Newer Older
pfdietz's avatar
pfdietz committed
1 2 3 4 5 6 7 8 9 10
;-*- Mode:     Lisp -*-
;;;; Author:   Paul Dietz
;;;; Created:  Tue Jan 21 22:08:21 2003
;;;; Contains: Tests of ARRAYP

(in-package :cl-test)

;;; Also tested by make-array.lsp

(deftest arrayp.1
11
  (notnot-mv (arrayp #(a b c)))
pfdietz's avatar
pfdietz committed
12 13 14
  t)

(deftest arrayp.2
15
  (notnot-mv (arrayp "abcd"))
pfdietz's avatar
pfdietz committed
16 17 18
  t)

(deftest arrayp.3
19
  (notnot-mv (arrayp #*001110101))
pfdietz's avatar
pfdietz committed
20 21 22
  t)

(deftest arrayp.4
23
  (notnot-mv (arrayp #0aNIL))
pfdietz's avatar
pfdietz committed
24 25 26
  t)

(deftest arrayp.5
27
  (notnot-mv (arrayp #2a((1 2 3)(4 5 6))))
pfdietz's avatar
pfdietz committed
28 29 30
  t)

(deftest arrayp.6
31
  (check-type-predicate #'arrayp 'array)
pfdietz's avatar
pfdietz committed
32 33
  nil)

34 35 36 37
(deftest arrayp.7
  (macrolet ((%m (z) z)) (arrayp (expand-in-current-env (%m 0))))
  nil)

38 39 40 41 42 43 44
(deftest arrayp.order.1
  (let ((i 0) a)
    (values
     (arrayp (progn (setf a (incf i)) nil))
     i a))
  nil 1 1)

pfdietz's avatar
pfdietz committed
45 46 47
;;; Error tests

(deftest arrayp.error.1
48 49
  (signals-error (arrayp) program-error)
  t)
pfdietz's avatar
pfdietz committed
50 51

(deftest arrayp.error.2
52 53
  (signals-error (arrayp #(a b c) nil) program-error)
  t)