File: array-total-size.lsp

package info (click to toggle)
cl-ansi-tests 20071218-1
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 7,000 kB
  • ctags: 22,025
  • sloc: lisp: 134,798; makefile: 144
file content (63 lines) | stat: -rw-r--r-- 1,318 bytes parent folder | download | duplicates (6)
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
;-*- 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.6
  (macrolet ((%m (z) z))
	    (array-total-size (expand-in-current-env (%m #(a b c)))))
  3)

(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
  (signals-error (array-total-size) program-error)
  t)

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

(deftest array-total-size.error.3
  (check-type-error #'array-total-size #'arrayp)
  nil)

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

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