;-*- Mode:     Lisp -*-
;;;; Author:   Paul Dietz
;;;; Created:  Tue Jan 21 22:01:09 2003
;;;; Contains: Tests of ARRAY-TOTAL-SIZE

(in-package :cl-test)

;;; More tests of ARRAY-TOTAL-SIZE are in make-array.lsp

(deftest array-total-size.1
  (array-total-size #0aNIL)
  1)

(deftest array-total-size.2
  (array-total-size "abcdef")
  6)

(deftest array-total-size.3
  (array-total-size #(a b c))
  3)

(deftest array-total-size.4
  (array-total-size #*0011010)
  7)

(deftest array-total-size.5
  (array-total-size #2a((1 2 3)(4 5 6)(7 8 9)(a b c)))
  12)

(deftest array-total-size.order.1
  (let ((i 0) a)
    (values
     (array-total-size (progn (setf a (incf i)) #(a b c d)))
     i a))
  4 1 1)

;;; Error tests

(deftest array-total-size.error.1
  (classify-error (array-total-size))
  program-error)

(deftest array-total-size.error.2
  (classify-error (array-total-size #(a b c) nil))
  program-error)

(deftest array-total-size.error.3
  (let (why)
    (loop for e in *mini-universe*
	  when (and (not (typep e 'array))
		    (not (eql (setq why 
				    (classify-error** `(array-total-size ',e)))
			      'type-error)))
	collect (list e why)))
  nil)

(deftest array-total-size.error.4
  (classify-error (array-total-size 0))
  type-error)

(deftest array-total-size.error.5
  (classify-error (locally (array-total-size 0) t))
  type-error)
