source: trunk/source/tests/ansi-tests/array-dimensions.lsp @ 8991

Last change on this file since 8991 was 8991, checked in by gz, 12 years ago

Check in the gcl ansi test suite (original, in preparation for making local changes)

File size: 1.5 KB
Line 
1;-*- Mode:     Lisp -*-
2;;;; Author:   Paul Dietz
3;;;; Created:  Tue Jan 21 06:59:37 2003
4;;;; Contains: Tests of ARRAY-DIMENSIONS
5
6(in-package :cl-test)
7
8;;; The tests in make-array.lsp also test this function
9
10(deftest array-dimensions.1
11  (array-dimensions #0aX)
12  nil)
13
14(deftest array-dimensions.2
15  (array-dimensions #(a b c d))
16  (4))
17
18(deftest array-dimensions.3
19  (array-dimensions #*0011011011)
20  (10))
21
22(deftest array-dimensions.4
23  (array-dimensions "abcdef")
24  (6))
25
26(deftest array-dimensions.5
27  (array-dimensions #2a((1 2 3)(4 5 6)(7 8 9)(10 11 12)))
28  (4 3))
29
30(deftest array-dimensions.6
31  (let ((a (make-array '(2 3 4) :adjustable t)))
32    (values (array-dimension a 0)
33            (array-dimension a 1)
34            (array-dimension a 2)))
35  2 3 4)
36
37(deftest array-dimensions.7
38  (let ((a (make-array '(10) :fill-pointer 5)))
39    (array-dimension a 0))
40  10)
41
42(deftest array-dimensions.8
43  (macrolet ((%m (z) z)) (array-dimensions
44                          (expand-in-current-env (%m #2a((a b)(c d)(e f))))))
45  (3 2))
46
47;;; Error tests
48
49(deftest array-dimensions.error.1
50  (signals-error (array-dimensions) program-error)
51  t)
52
53(deftest array-dimensions.error.2
54  (signals-error (array-dimensions #(a b c) nil)
55                 program-error)
56  t)
57
58(deftest array-dimensions.error.3
59  (check-type-error #'array-dimensions #'arrayp)
60  nil)
61
62(deftest array-dimensions.error.4
63  (signals-type-error x nil (array-dimensions x))
64  t)
65
66(deftest array-dimensions.error.5
67  (signals-error (locally (array-dimensions nil))
68                 type-error)
69  t)
Note: See TracBrowser for help on using the repository browser.