bit-vector-p.lsp 1.5 KB
Newer Older
1 2 3 4 5 6 7 8 9 10
;-*- Mode:     Lisp -*-
;;;; Author:   Paul Dietz
;;;; Created:  Sun Jan 26 20:16:50 2003
;;;; Contains: Tests of BIT-VECTOR-P

(in-package :cl-test)

(deftest bit-vector-p.2
  (notnot-mv (bit-vector-p #*))
  t)
sds's avatar
sds committed
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
(deftest bit-vector-p.3
  (notnot-mv (bit-vector-p #*00101))
  t)

(deftest bit-vector-p.4
  (bit-vector-p #(0 1 1 1 0 0))
  nil)

(deftest bit-vector-p.5
  (bit-vector-p "011100")
  nil)

(deftest bit-vector-p.6
  (bit-vector-p 0)
  nil)

(deftest bit-vector-p.7
  (bit-vector-p 1)
  nil)

(deftest bit-vector-p.8
  (bit-vector-p nil)
  nil)

(deftest bit-vector-p.9
  (bit-vector-p 'x)
  nil)

(deftest bit-vector-p.10
  (bit-vector-p '(0 1 1 0))
  nil)

(deftest bit-vector-p.11
  (bit-vector-p (make-array '(2 2) :element-type 'bit
sds's avatar
sds committed
46
                            :initial-element 0))
47 48 49
  nil)

(deftest bit-vector-p.12
50 51
  (check-type-predicate #'bit-vector-p 'bit-vector)
  nil)
52

53 54 55 56
(deftest bit-vector-p.13
  (macrolet
   ((%m (z) z))
   (values (notnot (bit-vector-p (expand-in-current-env (%m #*110101))))
sds's avatar
sds committed
57
           (bit-vector-p (expand-in-current-env (%m nil)))))
58 59
  t nil)

60 61 62 63 64 65 66 67 68 69 70 71 72 73 74
(deftest bit-vector-p.order.1
  (let ((i 0) x)
    (values
     (notnot (bit-vector-p (progn (setf x (incf i)) #*0010)))
     i x))
  t 1 1)

(deftest bit-vector-p.order.2
  (let ((i 0) x)
    (values
     (bit-vector-p (progn (setf x (incf i)) 'a))
     i x))
  nil 1 1)


75
(deftest bit-vector-p.error.1
76 77
  (signals-error (bit-vector-p) program-error)
  t)
78 79

(deftest bit-vector-p.error.2
80 81
  (signals-error (bit-vector-p #* #*) program-error)
  t)