source: trunk/source/tests/ansi-tests/cons-test-01.lsp @ 8991

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

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

File size: 2.6 KB
Line 
1;-*- Mode:     Lisp -*-
2;;;; Author:   Paul Dietz
3;;;; Created:  Sat Mar 28 07:29:48 1998
4;;;; Contains: Testing of CL Features related to "CONS", part 1
5
6(in-package :cl-test)
7
8(declaim (optimize (safety 3)))
9
10(compile-and-load "cons-aux.lsp")
11
12;;
13;; Test the subtype relationships between null, list, cons and atom
14;;
15(deftest subtypep-null-list
16  (subtypep* 'null 'list)
17  t t)
18
19(deftest subtypep-cons-list
20  (subtypep* 'cons 'list)
21  t t)
22
23(deftest subtypep-null-cons
24  (subtypep* 'null 'cons)
25  nil t)
26
27(deftest subtypep-cons-null
28  (subtypep* 'cons 'null)
29  nil t)
30
31(deftest subtypep-null-atom
32  (subtypep* 'null 'atom)
33  t t)
34
35(deftest subtypep-cons-atom
36  (subtypep* 'cons 'atom)
37  nil t)
38
39(deftest subtypep-atom-cons
40  (subtypep* 'atom 'cons)
41  nil t)
42
43(deftest subtypep-atom-list
44  (subtypep* 'atom 'list)
45  nil t)
46
47(deftest subtypep-list-atom
48  (subtypep* 'list 'atom)
49  nil t)
50
51;;
52;; Check that the elements of *universe* in type null
53;; are those for which the null predice is true.
54;;
55(deftest null-null-universe
56  (check-type-predicate 'null 'null)
57  nil)
58
59(defvar *cons-fns*
60  (list 'cons 'consp 'atom 'rplaca 'rplacd
61        'car 'cdr 'caar 'cadr 'cdar 'cddr
62        'caaar 'caadr 'cadar 'caddr
63        'cdaar 'cdadr 'cddar 'cdddr
64        'caaaar 'caaadr 'caadar 'caaddr
65        'cadaar 'cadadr 'caddar 'cadddr
66        'cdaaar 'cdaadr 'cdadar 'cdaddr
67        'cddaar 'cddadr 'cdddar 'cddddr
68        'copy-tree 'sublis 'nsublis
69        'subst 'subst-if 'subst-if-not
70        'nsubst 'nsubst-if 'nsubst-if-not
71        'tree-equal
72        'copy-list
73        'list
74        'list*
75        'list-length
76        'listp
77        'make-list
78        'first 'second 'third 'fourth
79        'fifth 'sixth 'seventh 'eighth 'ninth 'tenth
80        'nth
81        'endp
82        'null
83        'nconc
84        'append
85        'revappend 'nreconc
86        'butlast 'nbutlast
87        'last 'ldiff 'tailp
88        'nthcdr 'rest
89        'member 'member-if 'member-if-not
90        'mapc 'mapcar 'mapcan 'mapl 'maplist 'mapcon
91        'acons
92        'assoc 'assoc-if 'assoc-if-not
93        'copy-alist
94        'pairlis
95        'rassoc 'rassoc-if 'rassoc-if-not
96        'get-properties
97        'getf
98        'intersection
99        'nintersection
100        'adjoin
101        'set-difference 'nset-difference
102        'set-exclusive-or 'nset-exclusive-or
103        'subsetp
104        'union 'nunion
105        ))
106
107;; All the cons functions have a function binding
108
109(deftest function-bound-cons-fns
110  (loop
111   for x in *cons-fns* count
112   (when (or (not (fboundp x))
113             (not (functionp (symbol-function x))))
114     (format t "~%~S not bound to a function" x)
115     t))
116  0)
117
118;; All the cons-related macros have a macro binding
119(deftest macro-bound-cons-macros
120  (notnot-mv (every #'macro-function
121                    (list 'push 'pop 'pushnew 'remf)))
122  t)
123
124;; None of the cons-related functions have macro bindings
125(deftest no-cons-fns-are-macros
126  (some #'macro-function *cons-fns*)
127  nil)
Note: See TracBrowser for help on using the repository browser.