1 | ;;; mop-tests.lisp |
---|
2 | ;;; |
---|
3 | ;;; Copyright (C) 2010 Matthias Hölzl |
---|
4 | ;;; Copyright (C) 2010 Erik Huelsmann |
---|
5 | ;;; |
---|
6 | ;;; This program is free software; you can redistribute it and/or |
---|
7 | ;;; modify it under the terms of the GNU General Public License |
---|
8 | ;;; as published by the Free Software Foundation; either version 2 |
---|
9 | ;;; of the License, or (at your option) any later version. |
---|
10 | ;;; |
---|
11 | ;;; This program is distributed in the hope that it will be useful, |
---|
12 | ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
13 | ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
14 | ;;; GNU General Public License for more details. |
---|
15 | ;;; |
---|
16 | ;;; You should have received a copy of the GNU General Public License |
---|
17 | ;;; along with this program; if not, write to the Free Software |
---|
18 | ;;; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
---|
19 | |
---|
20 | ;;; CLOS related tests go clos-tssts.lisp |
---|
21 | |
---|
22 | (in-package #:abcl.test.lisp) |
---|
23 | |
---|
24 | (deftest compute-applicable-methods.foo.1 |
---|
25 | (equalp |
---|
26 | (mop:compute-applicable-methods #'mop-test.foo '(111 222)) |
---|
27 | (mop:compute-applicable-methods-using-classes |
---|
28 | #'mop-test.foo (find-classes 'fixnum 'fixnum))) |
---|
29 | t) |
---|
30 | |
---|
31 | (deftest compute-applicable-methods.foo.2 |
---|
32 | (equalp |
---|
33 | (mop:compute-applicable-methods #'mop-test.foo '(x y)) |
---|
34 | (mop:compute-applicable-methods-using-classes |
---|
35 | #'mop-test.foo (find-classes 'symbol 'symbol))) |
---|
36 | t) |
---|
37 | |
---|
38 | (deftest compute-applicable-methods.foo.3 |
---|
39 | (equalp |
---|
40 | (mop:compute-applicable-methods #'mop-test.foo '(111 y)) |
---|
41 | (mop:compute-applicable-methods-using-classes |
---|
42 | #'mop-test.foo (find-classes 'fixnum 'symbol))) |
---|
43 | t) |
---|
44 | |
---|
45 | (deftest compute-applicable-methods.foo.4 |
---|
46 | (equalp |
---|
47 | (mop:compute-applicable-methods #'mop-test.foo '(x 111)) |
---|
48 | (mop:compute-applicable-methods-using-classes |
---|
49 | #'mop-test.foo (find-classes 'symbol 'fixnum))) |
---|
50 | t) |
---|
51 | |
---|
52 | (deftest compute-applicable-methods.foo.5 |
---|
53 | (equalp |
---|
54 | (mop:compute-applicable-methods #'mop-test.foo '(111 "asdf")) |
---|
55 | (mop:compute-applicable-methods-using-classes |
---|
56 | #'mop-test.foo (find-classes 'fixnum 'simple-base-string))) |
---|
57 | t) |
---|
58 | |
---|
59 | (deftest compute-applicable-methods.foo.6 |
---|
60 | (equalp (mop:compute-applicable-methods #'mop-test.foo '(111 222)) |
---|
61 | (list (find-foo 'fixnum 'fixnum) |
---|
62 | (find-foo 'fixnum t) |
---|
63 | (find-foo t t))) |
---|
64 | t) |
---|
65 | |
---|
66 | (deftest compute-applicable-methods.foo.7 |
---|
67 | (equalp (mop:compute-applicable-methods #'mop-test.foo '(111 x)) |
---|
68 | (list (find-foo 'fixnum t) |
---|
69 | (find-foo t t))) |
---|
70 | t) |
---|
71 | |
---|
72 | (deftest compute-applicable-methods.foo.8 |
---|
73 | (equalp (mop:compute-applicable-methods #'mop-test.foo '(x 222)) |
---|
74 | (list (find-foo t t))) |
---|
75 | t) |
---|
76 | |
---|
77 | |
---|
78 | (deftest compute-applicable-methods.bar.1 |
---|
79 | (equalp |
---|
80 | (mop:compute-applicable-methods #'mop-test.bar '(111 222)) |
---|
81 | (mop:compute-applicable-methods-using-classes |
---|
82 | #'mop-test.bar (find-classes 'fixnum 'fixnum))) |
---|
83 | ;;; Bar with two fixnums might select EQL specializer for second |
---|
84 | ;;; argument. |
---|
85 | nil) |
---|
86 | |
---|
87 | (deftest compute-applicable-methods.bar.1a |
---|
88 | (equalp |
---|
89 | (mop:compute-applicable-methods #'mop-test.bar '(111 222)) |
---|
90 | (list (find-bar 'fixnum 'fixnum) |
---|
91 | (find-bar 'fixnum t) |
---|
92 | (find-bar t t))) |
---|
93 | t) |
---|
94 | |
---|
95 | (deftest compute-applicable-methods.bar.1b |
---|
96 | (equalp |
---|
97 | (mop:compute-applicable-methods #'mop-test.bar '(111 123)) |
---|
98 | (list (find-method #'mop-test.bar nil (list (find-class 'fixnum) '(eql 123))) |
---|
99 | (find-bar 'fixnum 'fixnum) |
---|
100 | (find-bar 'fixnum t) |
---|
101 | (find-bar t t))) |
---|
102 | t) |
---|
103 | |
---|
104 | (deftest compute-applicable-methods.bar.1c |
---|
105 | (mop:compute-applicable-methods-using-classes |
---|
106 | #'mop-test.bar (find-classes 'fixnum 'fixnum)) |
---|
107 | nil |
---|
108 | nil) |
---|
109 | |
---|
110 | (deftest compute-applicable-methods.bar.2 |
---|
111 | (equalp |
---|
112 | (mop:compute-applicable-methods #'mop-test.bar '(x y)) |
---|
113 | (mop:compute-applicable-methods-using-classes |
---|
114 | #'mop-test.bar (find-classes 'symbol 'symbol))) |
---|
115 | t) |
---|
116 | |
---|
117 | (deftest compute-applicable-methods.bar.2a |
---|
118 | (equalp |
---|
119 | (mop:compute-applicable-methods #'mop-test.bar '(x y)) |
---|
120 | (list (find-bar t t))) |
---|
121 | t) |
---|
122 | |
---|
123 | (deftest compute-applicable-methods.bar.3 |
---|
124 | (equalp |
---|
125 | (mop:compute-applicable-methods #'mop-test.bar '(111 y)) |
---|
126 | (mop:compute-applicable-methods-using-classes |
---|
127 | #'mop-test.bar (find-classes 'fixnum 'symbol))) |
---|
128 | t) |
---|
129 | |
---|
130 | (deftest compute-applicable-methods.bar.3a |
---|
131 | (equalp |
---|
132 | (mop:compute-applicable-methods #'mop-test.bar '(111 y)) |
---|
133 | (list (find-bar 'fixnum t) |
---|
134 | (find-bar t t))) |
---|
135 | t) |
---|
136 | |
---|
137 | (deftest compute-applicable-methods.bar.4 |
---|
138 | (equalp |
---|
139 | (mop:compute-applicable-methods #'mop-test.bar '(x 111)) |
---|
140 | (mop:compute-applicable-methods-using-classes |
---|
141 | #'mop-test.bar (find-classes 'symbol 'fixnum))) |
---|
142 | t) |
---|
143 | |
---|
144 | (deftest compute-applicable-methods.bar.4a |
---|
145 | (equalp |
---|
146 | (mop:compute-applicable-methods #'mop-test.bar '(x 111)) |
---|
147 | (list (find-bar t t))) |
---|
148 | t) |
---|
149 | |
---|
150 | (deftest compute-applicable-methods.bar.5 |
---|
151 | (equalp |
---|
152 | (mop:compute-applicable-methods #'mop-test.bar '(111 "asdf")) |
---|
153 | (mop:compute-applicable-methods-using-classes |
---|
154 | #'mop-test.bar (find-classes 'fixnum 'simple-base-string))) |
---|
155 | t) |
---|
156 | |
---|
157 | (deftest compute-applicable-methods.bar.5a |
---|
158 | (equalp |
---|
159 | (mop:compute-applicable-methods #'mop-test.bar '(111 "asdf")) |
---|
160 | (list (find-bar 'fixnum 'string) |
---|
161 | (find-bar 'fixnum t) |
---|
162 | (find-bar t t))) |
---|
163 | t) |
---|
164 | |
---|
165 | |
---|
166 | (deftest compute-applicable-methods.baz.1 |
---|
167 | (equalp |
---|
168 | (mop:compute-applicable-methods #'mop-test.baz '(111 222)) |
---|
169 | (mop:compute-applicable-methods-using-classes |
---|
170 | #'mop-test.baz (find-classes 'fixnum 'fixnum))) |
---|
171 | ;; Two fixnum arguments might select EQL specializer for first |
---|
172 | ;; argument. |
---|
173 | nil) |
---|
174 | |
---|
175 | (deftest compute-applicable-methods.baz.1a |
---|
176 | (equalp |
---|
177 | (mop:compute-applicable-methods #'mop-test.baz '(111 222)) |
---|
178 | (list (find-baz 'fixnum 'fixnum) |
---|
179 | (find-baz 'fixnum t) |
---|
180 | (find-baz t t))) |
---|
181 | t) |
---|
182 | |
---|
183 | (deftest compute-applicable-methods.baz.1b |
---|
184 | (equalp |
---|
185 | (mop:compute-applicable-methods #'mop-test.baz '(234 222)) |
---|
186 | (list (find-method #'mop-test.baz nil (list '(eql 234) (find-class 'fixnum))) |
---|
187 | (find-baz 'fixnum 'fixnum) |
---|
188 | (find-baz 'fixnum t) |
---|
189 | (find-baz t t))) |
---|
190 | t) |
---|
191 | |
---|
192 | (deftest compute-applicable-methods.baz.1c |
---|
193 | (mop:compute-applicable-methods-using-classes |
---|
194 | #'mop-test.baz (find-classes 'fixnum 'fixnum)) |
---|
195 | nil |
---|
196 | nil) |
---|
197 | |
---|
198 | (deftest compute-applicable-methods.baz.2 |
---|
199 | (equalp |
---|
200 | (mop:compute-applicable-methods #'mop-test.baz '(x y)) |
---|
201 | (mop:compute-applicable-methods-using-classes |
---|
202 | #'mop-test.baz (find-classes 'symbol 'symbol))) |
---|
203 | t) |
---|
204 | |
---|
205 | (deftest compute-applicable-methods.baz.3 |
---|
206 | (equalp |
---|
207 | (mop:compute-applicable-methods #'mop-test.baz '(111 y)) |
---|
208 | (mop:compute-applicable-methods-using-classes |
---|
209 | #'mop-test.baz (find-classes 'fixnum 'symbol))) |
---|
210 | t) |
---|
211 | |
---|
212 | (deftest compute-applicable-methods.baz.4 |
---|
213 | (equalp |
---|
214 | (mop:compute-applicable-methods #'mop-test.baz '(x 111)) |
---|
215 | (mop:compute-applicable-methods-using-classes |
---|
216 | #'mop-test.baz (find-classes 'symbol 'fixnum))) |
---|
217 | t) |
---|
218 | |
---|
219 | (deftest compute-applicable-methods.baz.5 |
---|
220 | (equalp |
---|
221 | (mop:compute-applicable-methods #'mop-test.baz '(111 "asdf")) |
---|
222 | (mop:compute-applicable-methods-using-classes |
---|
223 | #'mop-test.baz (find-classes 'fixnum 'simple-base-string))) |
---|
224 | t) |
---|
225 | |
---|
226 | |
---|
227 | (deftest compute-applicable-methods.quux.1 |
---|
228 | (equalp |
---|
229 | (mop:compute-applicable-methods #'mop-test.quux '(111 222)) |
---|
230 | (mop:compute-applicable-methods-using-classes |
---|
231 | #'mop-test.quux (find-classes 'fixnum 'fixnum))) |
---|
232 | t) |
---|
233 | |
---|
234 | (deftest compute-applicable-methods.quux.1a |
---|
235 | (equalp |
---|
236 | (mop:compute-applicable-methods #'mop-test.quux '(111 222)) |
---|
237 | (list (find-quux 'fixnum 'fixnum) |
---|
238 | (find-quux 'fixnum t) |
---|
239 | (find-quux t t))) |
---|
240 | t) |
---|
241 | |
---|
242 | (deftest compute-applicable-methods.quux.2 |
---|
243 | (equalp |
---|
244 | (mop:compute-applicable-methods #'mop-test.quux '(x y)) |
---|
245 | (mop:compute-applicable-methods-using-classes |
---|
246 | #'mop-test.quux (find-classes 'symbol 'symbol))) |
---|
247 | t) |
---|
248 | |
---|
249 | (deftest compute-applicable-methods.quux.2a |
---|
250 | (equalp |
---|
251 | (mop:compute-applicable-methods #'mop-test.quux '(x y)) |
---|
252 | (list (find-quux t t))) |
---|
253 | t) |
---|
254 | |
---|
255 | (deftest compute-applicable-methods.quux.3 |
---|
256 | (equalp |
---|
257 | (mop:compute-applicable-methods #'mop-test.quux '(111 y)) |
---|
258 | (mop:compute-applicable-methods-using-classes |
---|
259 | #'mop-test.quux (find-classes 'fixnum 'symbol))) |
---|
260 | t) |
---|
261 | |
---|
262 | (deftest compute-applicable-methods.quux.3a |
---|
263 | (equalp |
---|
264 | (mop:compute-applicable-methods #'mop-test.quux '(111 y)) |
---|
265 | (list (find-quux 'fixnum t) |
---|
266 | (find-quux t t))) |
---|
267 | t) |
---|
268 | |
---|
269 | (deftest compute-applicable-methods.quux.4 |
---|
270 | (equalp |
---|
271 | (mop:compute-applicable-methods #'mop-test.quux '(x 111)) |
---|
272 | (mop:compute-applicable-methods-using-classes |
---|
273 | #'mop-test.quux (find-classes 'symbol 'fixnum))) |
---|
274 | ;; Symbol/fixnum might trigger EQL spezializer |
---|
275 | nil) |
---|
276 | |
---|
277 | (deftest compute-applicable-methods.quux.4a |
---|
278 | (equalp |
---|
279 | (mop:compute-applicable-methods #'mop-test.quux '(x 111)) |
---|
280 | (list (find-quux t t))) |
---|
281 | t) |
---|
282 | |
---|
283 | (deftest compute-applicable-methods.quux.4b |
---|
284 | (equalp |
---|
285 | (mop:compute-applicable-methods #'mop-test.quux '(:foo 111)) |
---|
286 | (list (find-method #'mop-test.quux nil |
---|
287 | (list '(eql :foo) (find-class 'fixnum))) |
---|
288 | |
---|
289 | (find-quux t t))) |
---|
290 | t) |
---|
291 | |
---|
292 | (deftest compute-applicable-methods.quux.4c |
---|
293 | (mop:compute-applicable-methods-using-classes |
---|
294 | #'mop-test.quux (find-classes 'symbol 'fixnum)) |
---|
295 | nil |
---|
296 | nil) |
---|
297 | |
---|
298 | (deftest compute-applicable-methods.quux.5 |
---|
299 | (equalp |
---|
300 | (mop:compute-applicable-methods #'mop-test.quux '(111 "asdf")) |
---|
301 | (mop:compute-applicable-methods-using-classes |
---|
302 | #'mop-test.quux (find-classes 'fixnum 'simple-base-string))) |
---|
303 | t) |
---|
304 | |
---|
305 | |
---|