Commit d116d8ed authored by pfdietz's avatar pfdietz

More tests for arrays, vectors, and simple arrays. Tests for array and vector classes.

parent fe4437a2
;-*- Mode: Lisp -*-
;;;; Author: Paul Dietz
;;;; Created: Sun Jan 26 07:45:25 2003
;;;; Contains: Tests for ARRAY as a class
(in-package :cl-test)
(deftest array-as-class.1
(notnot-mv (typep #() (find-class 'array)))
t)
(deftest array-as-class.2
(notnot-mv (typep #(a b c) (find-class 'array)))
t)
(deftest array-as-class.3
(notnot-mv (typep #0aNIL (find-class 'array)))
t)
(deftest array-as-class.4
(notnot-mv (typep #2a((a b)(c d)) (find-class 'array)))
t)
(deftest array-as-class.5
(notnot-mv (typep "abcde" (find-class 'array)))
t)
(deftest array-as-class.6
(notnot-mv (typep #*0011101 (find-class 'array)))
t)
(deftest array-as-class.7
(subtypep* 'array (find-class 'array))
t t)
(deftest array-as-class.8
(subtypep* (find-class 'array) 'array)
t t)
(deftest array-as-class.9
(typep nil (find-class 'array))
nil)
(deftest array-as-class.10
(typep 'x (find-class 'array))
nil)
(deftest array-as-class.11
(typep '(a b c) (find-class 'array))
nil)
(deftest array-as-class.12
(typep 10.0 (find-class 'array))
nil)
(deftest array-as-class.13
(typep #'(lambda (x) (cons x nil)) (find-class 'array))
nil)
(deftest array-as-class.14
(typep 1 (find-class 'array))
nil)
(deftest array-as-class.15
(typep (1+ most-positive-fixnum) (find-class 'array))
nil)
......@@ -36,6 +36,8 @@
((not (typep a 'array))
:fail-not-array)
((not (typep a (find-class 'array)))
:fail-not-array-class)
((not (typep a '(array *)))
:fail-not-array2)
((not (typep a `(array * ,dimensions-list)))
......
......@@ -31,6 +31,35 @@
(notnot-mv (typep #*010101 'array))
t)
(deftest array.1.7
(typep nil 'array)
nil)
(deftest array.1.8
(typep 'x 'array)
nil)
(deftest array.1.9
(typep '(a b c) 'array)
nil)
(deftest array.1.10
(typep 10.0 'array)
nil)
(deftest array.1.11
(typep #'(lambda (x) (cons x nil)) 'array)
nil)
(deftest array.1.12
(typep 1 'array)
nil)
(deftest array.1.13
(typep (1+ most-positive-fixnum) 'array)
nil)
;;; Tests of (array *)
(deftest array.2.1
......
......@@ -136,6 +136,9 @@
(compile-and-load "array-aux.lsp")
(load "array.lsp")
(load "array-t.lsp")
(load "array-as-class.lsp")
(load "simple-array.lsp")
(load "simple-array-t.lsp")
(load "make-array.lsp")
(load "adjustable-array-p.lsp")
(load "array-displacement.lsp")
......
;-*- Mode: Lisp -*-
;;;; Author: Paul Dietz
;;;; Created: Sun Jan 26 07:23:45 2003
;;;; Contains: Tests of SIMPLE-ARRAY on T element type
(in-package :cl-test)
;;; Tests of (simple-array t)
(deftest simple-array-t.2.1
(notnot-mv (typep #() '(simple-array t)))
t)
(deftest simple-array-t.2.2
(notnot-mv (typep #0aX '(simple-array t)))
t)
(deftest simple-array-t.2.3
(notnot-mv (typep #2a(()) '(simple-array t)))
t)
(deftest simple-array-t.2.4
(notnot-mv (typep #(1 2 3) '(simple-array t)))
t)
(deftest simple-array-t.2.5
(typep "abcd" '(simple-array t))
nil)
(deftest simple-array-t.2.6
(typep #*010101 '(simple-array t))
nil)
;;; Tests of (simple-array t ())
(deftest simple-array-t.3.1
(notnot-mv (typep #() '(simple-array t nil)))
nil)
(deftest simple-array-t.3.2
(notnot-mv (typep #0aX '(simple-array t nil)))
t)
(deftest simple-array-t.3.3
(typep #2a(()) '(simple-array t nil))
nil)
(deftest simple-array-t.3.4
(typep #(1 2 3) '(simple-array t nil))
nil)
(deftest simple-array-t.3.5
(typep "abcd" '(simple-array t nil))
nil)
(deftest simple-array-t.3.6
(typep #*010101 '(simple-array t nil))
nil)
;;; Tests of (simple-array t 1)
;;; The '1' indicates rank, so this is equivalent to 'vector'
(deftest simple-array-t.4.1
(notnot-mv (typep #() '(simple-array t 1)))
t)
(deftest simple-array-t.4.2
(typep #0aX '(simple-array t 1))
nil)
(deftest simple-array-t.4.3
(typep #2a(()) '(simple-array t 1))
nil)
(deftest simple-array-t.4.4
(notnot-mv (typep #(1 2 3) '(simple-array t 1)))
t)
(deftest simple-array-t.4.5
(typep "abcd" '(simple-array t 1))
nil)
(deftest simple-array-t.4.6
(typep #*010101 '(simple-array t 1))
nil)
;;; Tests of (simple-array t 0)
(deftest simple-array-t.5.1
(typep #() '(simple-array t 0))
nil)
(deftest simple-array-t.5.2
(notnot-mv (typep #0aX '(simple-array t 0)))
t)
(deftest simple-array-t.5.3
(typep #2a(()) '(simple-array t 0))
nil)
(deftest simple-array-t.5.4
(typep #(1 2 3) '(simple-array t 0))
nil)
(deftest simple-array-t.5.5
(typep "abcd" '(simple-array t 0))
nil)
(deftest simple-array-t.5.6
(typep #*010101 '(simple-array t 0))
nil)
;;; Tests of (simple-array t *)
(deftest simple-array-t.6.1
(notnot-mv (typep #() '(simple-array t *)))
t)
(deftest simple-array-t.6.2
(notnot-mv (typep #0aX '(simple-array t *)))
t)
(deftest simple-array-t.6.3
(notnot-mv (typep #2a(()) '(simple-array t *)))
t)
(deftest simple-array-t.6.4
(notnot-mv (typep #(1 2 3) '(simple-array t *)))
t)
(deftest simple-array-t.6.5
(typep "abcd" '(simple-array t *))
nil)
(deftest simple-array-t.6.6
(typep #*010101 '(simple-array t *))
nil)
;;; Tests of (simple-array t 2)
(deftest simple-array-t.7.1
(typep #() '(simple-array t 2))
nil)
(deftest simple-array-t.7.2
(typep #0aX '(simple-array t 2))
nil)
(deftest simple-array-t.7.3
(notnot-mv (typep #2a(()) '(simple-array t 2)))
t)
(deftest simple-array-t.7.4
(typep #(1 2 3) '(simple-array t 2))
nil)
(deftest simple-array-t.7.5
(typep "abcd" '(simple-array t 2))
nil)
(deftest simple-array-t.7.6
(typep #*010101 '(simple-array t 2))
nil)
;;; Testing '(simple-array t (--))
(deftest simple-array-t.8.1
(typep #() '(simple-array t (1)))
nil)
(deftest simple-array-t.8.2
(notnot-mv (typep #() '(simple-array t (0))))
t)
(deftest simple-array-t.8.3
(notnot-mv (typep #() '(simple-array t (*))))
t)
(deftest simple-array-t.8.4
(typep #(a b c) '(simple-array t (2)))
nil)
(deftest simple-array-t.8.5
(notnot-mv (typep #(a b c) '(simple-array t (3))))
t)
(deftest simple-array-t.8.6
(notnot-mv (typep #(a b c) '(simple-array t (*))))
t)
(deftest simple-array-t.8.7
(typep #(a b c) '(simple-array t (4)))
nil)
(deftest simple-array-t.8.8
(typep #2a((a b c)) '(simple-array t (*)))
nil)
(deftest simple-array-t.8.9
(typep #2a((a b c)) '(simple-array t (3)))
nil)
(deftest simple-array-t.8.10
(typep #2a((a b c)) '(simple-array t (1)))
nil)
(deftest simple-array-t.8.11
(typep "abc" '(simple-array t (2)))
nil)
(deftest simple-array-t.8.12
(typep "abc" '(simple-array t (3)))
nil)
(deftest simple-array-t.8.13
(typep "abc" '(simple-array t (*)))
nil)
(deftest simple-array-t.8.14
(typep "abc" '(simple-array t (4)))
nil)
;;; Two dimensional simple-array type tests
(deftest simple-array-t.9.1
(typep #() '(simple-array t (* *)))
nil)
(deftest simple-array-t.9.2
(typep "abc" '(simple-array t (* *)))
nil)
(deftest simple-array-t.9.3
(typep #(a b c) '(simple-array t (3 *)))
nil)
(deftest simple-array-t.9.4
(typep #(a b c) '(simple-array t (* 3)))
nil)
(deftest simple-array-t.9.5
(typep "abc" '(simple-array t (3 *)))
nil)
(deftest simple-array-t.9.6
(typep "abc" '(simple-array t (* 3)))
nil)
(deftest simple-array-t.9.7
(notnot-mv (typep #2a((a b)(c d)(e f)) '(simple-array t (* *))))
t)
(deftest simple-array-t.9.8
(notnot-mv (typep #2a((a b)(c d)(e f)) '(simple-array t (3 *))))
t)
(deftest simple-array-t.9.9
(typep #2a((a b)(c d)(e f)) '(simple-array t (2 *)))
nil)
(deftest simple-array-t.9.10
(notnot-mv (typep #2a((a b)(c d)(e f)) '(simple-array t (* 2))))
t)
(deftest simple-array-t.9.11
(typep #2a((a b)(c d)(e f)) '(simple-array t (* 3)))
nil)
(deftest simple-array-t.9.12
(notnot-mv (typep #2a((a b)(c d)(e f)) '(simple-array t (3 2))))
t)
(deftest simple-array-t.9.13
(typep #2a((a b)(c d)(e f)) '(simple-array t (2 3)))
nil)
;-*- Mode: Lisp -*-
;;;; Author: Paul Dietz
;;;; Created: Sun Jan 26 07:20:31 2003
;;;; Contains: Tests of SIMPLE-ARRAY
(in-package :cl-test)
;;; Tests of simple-array by itself
(deftest simple-array.1.1
(notnot-mv (typep #() 'simple-array))
t)
(deftest simple-array.1.2
(notnot-mv (typep #0aX 'simple-array))
t)
(deftest simple-array.1.3
(notnot-mv (typep #2a(()) 'simple-array))
t)
(deftest simple-array.1.4
(notnot-mv (typep #(1 2 3) 'simple-array))
t)
(deftest simple-array.1.5
(notnot-mv (typep "abcd" 'simple-array))
t)
(deftest simple-array.1.6
(notnot-mv (typep #*010101 'simple-array))
t)
(deftest simple-array.1.7
(typep nil 'simple-array)
nil)
(deftest simple-array.1.8
(typep 'x 'simple-array)
nil)
(deftest simple-array.1.9
(typep '(a b c) 'simple-array)
nil)
(deftest simple-array.1.10
(typep 10.0 'simple-array)
nil)
(deftest simple-array.1.11
(typep #'(lambda (x) (cons x nil)) 'simple-array)
nil)
(deftest simple-array.1.12
(typep 1 'simple-array)
nil)
(deftest simple-array.1.13
(typep (1+ most-positive-fixnum) 'simple-array)
nil)
;;; Tests of (simple-array *)
(deftest simple-array.2.1
(notnot-mv (typep #() '(simple-array *)))
t)
(deftest simple-array.2.2
(notnot-mv (typep #0aX '(simple-array *)))
t)
(deftest simple-array.2.3
(notnot-mv (typep #2a(()) '(simple-array *)))
t)
(deftest simple-array.2.4
(notnot-mv (typep #(1 2 3) '(simple-array *)))
t)
(deftest simple-array.2.5
(notnot-mv (typep "abcd" '(simple-array *)))
t)
(deftest simple-array.2.6
(notnot-mv (typep #*010101 '(simple-array *)))
t)
;;; Tests of (simple-array * ())
(deftest simple-array.3.1
(notnot-mv (typep #() '(simple-array * nil)))
nil)
(deftest simple-array.3.2
(notnot-mv (typep #0aX '(simple-array * nil)))
t)
(deftest simple-array.3.3
(typep #2a(()) '(simple-array * nil))
nil)
(deftest simple-array.3.4
(typep #(1 2 3) '(simple-array * nil))
nil)
(deftest simple-array.3.5
(typep "abcd" '(simple-array * nil))
nil)
(deftest simple-array.3.6
(typep #*010101 '(simple-array * nil))
nil)
;;; Tests of (simple-array * 1)
;;; The '1' indicates rank, so this is equivalent to 'vector'
(deftest simple-array.4.1
(notnot-mv (typep #() '(simple-array * 1)))
t)
(deftest simple-array.4.2
(typep #0aX '(simple-array * 1))
nil)
(deftest simple-array.4.3
(typep #2a(()) '(simple-array * 1))
nil)
(deftest simple-array.4.4
(notnot-mv (typep #(1 2 3) '(simple-array * 1)))
t)
(deftest simple-array.4.5
(notnot-mv (typep "abcd" '(simple-array * 1)))
t)
(deftest simple-array.4.6
(notnot-mv (typep #*010101 '(simple-array * 1)))
t)
;;; Tests of (simple-array * 0)
(deftest simple-array.5.1
(typep #() '(simple-array * 0))
nil)
(deftest simple-array.5.2
(notnot-mv (typep #0aX '(simple-array * 0)))
t)
(deftest simple-array.5.3
(typep #2a(()) '(simple-array * 0))
nil)
(deftest simple-array.5.4
(typep #(1 2 3) '(simple-array * 0))
nil)
(deftest simple-array.5.5
(typep "abcd" '(simple-array * 0))
nil)
(deftest simple-array.5.6
(typep #*010101 '(simple-array * 0))
nil)
;;; Tests of (simple-array * *)
(deftest simple-array.6.1
(notnot-mv (typep #() '(simple-array * *)))
t)
(deftest simple-array.6.2
(notnot-mv (typep #0aX '(simple-array * *)))
t)
(deftest simple-array.6.3
(notnot-mv (typep #2a(()) '(simple-array * *)))
t)
(deftest simple-array.6.4
(notnot-mv (typep #(1 2 3) '(simple-array * *)))
t)
(deftest simple-array.6.5
(notnot-mv (typep "abcd" '(simple-array * *)))
t)
(deftest simple-array.6.6
(notnot-mv (typep #*010101 '(simple-array * *)))
t)
;;; Tests of (simple-array * 2)
(deftest simple-array.7.1
(typep #() '(simple-array * 2))
nil)
(deftest simple-array.7.2
(typep #0aX '(simple-array * 2))
nil)
(deftest simple-array.7.3
(notnot-mv (typep #2a(()) '(simple-array * 2)))
t)
(deftest simple-array.7.4
(typep #(1 2 3) '(simple-array * 2))
nil)
(deftest simple-array.7.5
(typep "abcd" '(simple-array * 2))
nil)
(deftest simple-array.7.6
(typep #*010101 '(simple-array * 2))
nil)
;;; Testing '(simple-array * (--))
(deftest simple-array.8.1
(typep #() '(simple-array * (1)))
nil)
(deftest simple-array.8.2
(notnot-mv (typep #() '(simple-array * (0))))
t)
(deftest simple-array.8.3
(notnot-mv (typep #() '(simple-array * (*))))
t)
(deftest simple-array.8.4
(typep #(a b c) '(simple-array * (2)))
nil)
(deftest simple-array.8.5
(notnot-mv (typep #(a b c) '(simple-array * (3))))
t)
(deftest simple-array.8.6
(notnot-mv (typep #(a b c) '(simple-array * (*))))
t)
(deftest simple-array.8.7
(typep #(a b c) '(simple-array * (4)))
nil)
(deftest simple-array.8.8
(typep #2a((a b c)) '(simple-array * (*)))
nil)
(deftest simple-array.8.9
(typep #2a((a b c)) '(simple-array * (3)))
nil)
(deftest simple-array.8.10
(typep #2a((a b c)) '(simple-array * (1)))
nil)
(deftest simple-array.8.11
(typep "abc" '(simple-array * (2)))
nil)
(deftest simple-array.8.12
(notnot-mv (typep "abc" '(simple-array * (3))))
t)
(deftest simple-array.8.13
(notnot-mv (typep "abc" '(simple-array * (*))))
t)
(deftest simple-array.8.14
(typep "abc" '(simple-array * (4)))
nil)
;;; Two dimensional simple-array type tests
(deftest simple-array.9.1
(typep #() '(simple-array * (* *)))
nil)
(deftest simple-array.9.2
(typep "abc" '(simple-array * (* *)))
nil)
(deftest simple-array.9.3
(typep #(a b c) '(simple-array * (3 *)))
nil)
(deftest simple-array.9.4
(typep #(a b c) '(simple-array * (* 3)))
nil)
(deftest simple-array.9.5
(typep "abc" '(simple-array * (3 *)))
nil)
(deftest simple-array.9.6
(typep "abc" '(simple-array * (* 3)))
nil)
(deftest simple-array.9.7
(notnot-mv (typep #2a((a b)(c d)(e f)) '(simple-array * (* *))))
t)
(deftest simple-array.9.8
(notnot-mv (typep #2a((a b)(c d)(e f)) '(simple-array * (3 *))))
t)
(deftest simple-array.9.9
(typep #2a((a b)(c d)(e f)) '(simple-array * (2 *)))
nil)
(deftest simple-array.9.10
(notnot-mv (typep #2a((a b)(c d)(e f)) '(simple-array * (* 2))))
t)
(deftest simple-array.9.11
(typep #2a((a b)(c d)(e f)) '(simple-array * (* 3)))
nil)
(deftest simple-array.9.12
(notnot-mv (typep #2a((a b)(c d)(e f)) '(simple-array * (3 2))))
t)
(deftest simple-array.9.13
(typep #2a((a b)(c d)(e f)) '(simple-array * (2 3)))
nil)
......@@ -192,7 +192,81 @@
(deftest vector.type.44
(notnot-mv (typep (make-array '10 :element-type 'long-float) 'vector))
t)
;;; Tests of vector as class
(deftest vector-as-class.1
(notnot-mv (find-class 'vector))
t)
(deftest vector-as-class.2
(notnot-mv (typep #() (find-class 'vector)))
t)
(deftest vector-as-class.3
(notnot-mv (typep #(a b c) (find-class 'vector)))
t)
(deftest vector-as-class.4
(notnot-mv (typep "" (find-class 'vector)))
t)
(deftest vector-as-class.5
(notnot-mv (typep "abcd" (find-class 'vector)))
t)
(deftest vector-as-class.6
(notnot-mv (typep #* (find-class 'vector)))
t)
(deftest vector-as-class.7
(notnot-mv (typep #*01101010100 (find-class 'vector)))
t)
(deftest vector-as-class.8
(typep #0aNIL (find-class 'vector))
nil)
(deftest vector-as-class.9
(typep #2a((a b)(c d)) (find-class 'vector))
nil)
(deftest vector-as-class.10
(typep (make-array '(1 0)) (find-class 'vector))
nil)
(deftest vector-as-class.11
(typep (make-array '(0 1)) (find-class 'vector))
nil)
(deftest vector-as-class.12
(typep 1 (find-class 'vector))
nil)
(deftest vector-as-class.13
(typep nil (find-class 'vector))
nil)