source: trunk/source/tests/ansi-tests/subtypep-member.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: 5.4 KB
Line 
1;-*- Mode:     Lisp -*-
2;;;; Author:   Paul Dietz
3;;;; Created:  Sat Feb 15 11:58:06 2003
4;;;; Contains: Tests for subtype relationships on member types
5
6(in-package :cl-test)
7
8(compile-and-load "types-aux.lsp")
9
10;;; SUBTYPEP on MEMBER types
11
12(deftest subtypep.member.1
13  (check-all-subtypep '(member a b c) '(member a b c d))
14  nil)
15
16(deftest subtypep.member.2
17  (check-all-not-subtypep '(member a b c) '(member a b))
18  nil)
19
20(deftest subtypep.member.3
21  (check-equivalence '(member) nil)
22  nil)
23
24(deftest subtypep.member.4
25  (check-all-subtypep '(eql b) '(member a b c))
26  nil)
27
28(deftest subtypep.member.5
29  (check-all-subtypep '(member a b c d e) 'symbol)
30  nil)
31
32(deftest subtypep.member.6
33  (check-all-not-subtypep '(member a b 10 d e) 'symbol)
34  nil)
35
36(deftest subtypep.member.7
37  (check-all-subtypep 'null '(member a b nil c d e))
38  nil)
39
40(deftest subtypep.member.8
41  (check-all-not-subtypep 'null '(member a b c d e))
42  nil)
43
44(deftest subtypep.member.9
45  (let ((b1 (1+ most-positive-fixnum))
46        (b2 (1+ most-positive-fixnum)))
47    (check-all-subtypep `(member 10 ,b1 20) `(member 10 20 ,b2)))
48  nil)
49
50(deftest subtypep.member.10
51  (check-all-subtypep '(member :a :b :c) 'keyword)
52  nil)
53
54(deftest subtypep.member.11
55  (let ((b1 (copy-list '(a)))
56        (b2 (copy-list '(a))))
57    (check-all-not-subtypep `(member 10 ,b1 20) `(member 10 20 ,b2)))
58  nil)
59
60(deftest subtypep.member.12
61  (let ((b1 '(a)))
62    (check-all-subtypep `(member 10 ,b1 20) `(member 10 20 ,b1)))
63  nil)
64
65(deftest subtypep.member.13
66  (check-all-subtypep '(member 10 20 30) '(integer 0 100))
67  nil)
68
69(deftest subtypep.member.14
70  (check-all-subtypep '(integer 3 6) '(member 0 1 2 3 4 5 6 7 8 100))
71  nil)
72
73(deftest subtypep.member.15
74  (check-all-not-subtypep '(integer 3 6) '(member 0 1 2 3 5 6 7 8))
75  nil)
76
77(deftest subtypep.member.16
78  (check-equivalence '(integer 2 5) '(member 2 5 4 3))
79  nil)
80
81(deftest subtypep.member.17
82  (let ((s1 (copy-seq "abc"))
83        (s2 (copy-seq "abc")))
84    (let ((t1 `(member ,s1))
85          (t2 `(member ,s2)))
86      (cond
87       ((subtypep t1 t2) "T1 is subtype of T2")
88       ((subtypep t2 t1) "T2 is subtype of T1")
89       (t (check-disjointness t1 t2)))))
90  nil)
91
92(deftest subtypep.member.18
93  (let ((s1 (copy-seq '(a b c)))
94        (s2 (copy-seq '(a b c))))
95    (let ((t1 `(member ,s1))
96          (t2 `(member ,s2)))
97      (cond
98       ((subtypep t1 t2) "T1 is subtype of T2")
99       ((subtypep t2 t1) "T2 is subtype of T1")
100       (t (check-disjointness t1 t2)))))
101  nil)
102
103(deftest subtypep.member.19
104  (let ((i1 (1+ most-positive-fixnum))
105        (i2 (1+ most-positive-fixnum)))
106    (check-equivalence `(member 0 ,i1) `(member 0 ,i2)))
107  nil)
108
109(deftest subtypep.member.20
110  (check-equivalence '(and (member a b c d) (member e d b f g))
111                     '(member b d))
112  nil)
113
114(deftest subtypep.member.21
115  (check-equivalence '(and (member a b c d) (member e d f g))
116                     '(eql d))
117  nil)
118
119(deftest subtypep.member.22
120  (check-equivalence '(and (member a b c d) (member e f g))
121                     nil)
122  nil)
123
124(deftest subtypep.member.23
125  (check-equivalence '(or (member a b c) (member z b w))
126                     '(member z a b w c))
127  nil)
128
129(deftest subtypep.member.24
130  (check-equivalence '(or (member a b c) (eql d))
131                     '(member d c b a))
132  nil)
133
134(deftest subtypep.member.25
135  (check-equivalence 'boolean '(member nil t))
136  nil)
137
138(deftest subtypep.member.26
139  (check-equivalence '(or (eql a) (eql b))
140                     '(member a b))
141  nil)
142
143(deftest subtypep.member.27
144  (check-all-subtypep '(member a b c d) '(satisfies symbolp))
145  nil)
146
147(deftest subtypep.member.28
148  (check-all-subtypep '(member a b c d) t)
149  nil)
150
151(deftest subtypep.member.29
152  (check-all-not-subtypep '(member a b 10 z) '(satisfies symbolp))
153  nil)
154
155(deftest subtypep.member.30
156  (check-disjointness '(member 1 6 10) '(satisfies symbolp))
157  nil)
158
159(deftest subtypep.member.31
160  (check-equivalence '(member a b c d) '(member c d b a))
161  nil)
162
163(deftest subtypep.member.32
164  (check-all-not-subtypep '(not (member a b 10 z)) '(satisfies symbolp))
165  nil)
166
167(deftest subtypep.member.33
168  (check-all-not-subtypep  '(satisfies symbolp) '(member a b 10 z))
169  nil)
170
171(deftest subtypep.member.34
172  (check-all-not-subtypep '(member a b 10 z) '(not (satisfies symbolp)))
173  nil)
174
175(deftest subtypep.member.35
176  (check-all-not-subtypep  '(satisfies symbolp) '(member a b c d))
177  nil)
178
179(deftest subtypep.member.36
180  (check-disjointness '(eql a) '(or (member b c d) (eql e)))
181  nil)
182
183(deftest subtypep.member.37
184  (check-equivalence
185   '(and (member a b c d) (not (eql c)))
186   '(member a b d))
187  nil)
188
189(deftest subtypep.member.38
190  (check-equivalence
191   '(and (member a b c d e f g)
192         (not (member b f)))
193   '(member a c d e g))
194  nil)
195
196(deftest subtypep.member.39
197  (check-equivalence
198   '(and (not (member b d e f g))
199         (not (member x y b z d)))
200   '(not (member b d e f g x y z)))
201  nil)
202
203(deftest subtypep.member.40
204  (check-equivalence
205   '(and (not (eql a)) (not (eql b)))
206   '(not (member a b)))
207  nil)
208
209(deftest subtypep.member.41
210  (check-equivalence
211   '(and (not (eql a)) (not (eql b)) (not (eql c)))
212   '(not (member c b a)))
213  nil)
214
215(deftest subtypep.member.42
216  (check-equivalence
217   '(and (not (member a b)) (not (member b c)))
218   '(not (member c b a)))
219  nil)
220
221(deftest subtypep.member.43
222  (check-equivalence
223   '(and (not (member a g b k e)) (not (member b h k c f)))
224   '(not (member c b k a e f g h)))
225  nil)
226
227(deftest subtypep.member.44
228  (check-equivalence
229   '(and (integer 0 30) (not (member 3 4 5 9 10 11 17 18 19)))
230   '(or (integer 0 2) (integer 6 8) (integer 12 16) (integer 20 30)))
231  nil)
Note: See TracBrowser for help on using the repository browser.