1 | ;;; mop-tests-setup.lisp |
---|
2 | ;;; |
---|
3 | ;;; Copyright (C) 2010 Matthias Hölzl |
---|
4 | ;;; |
---|
5 | ;;; This program is free software; you can redistribute it and/or |
---|
6 | ;;; modify it under the terms of the GNU General Public License |
---|
7 | ;;; as published by the Free Software Foundation; either version 2 |
---|
8 | ;;; of the License, or (at your option) any later version. |
---|
9 | ;;; |
---|
10 | ;;; This program is distributed in the hope that it will be useful, |
---|
11 | ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
12 | ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
13 | ;;; GNU General Public License for more details. |
---|
14 | ;;; |
---|
15 | ;;; You should have received a copy of the GNU General Public License |
---|
16 | ;;; along with this program; if not, write to the Free Software |
---|
17 | ;;; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
---|
18 | |
---|
19 | ;;; Definitions used by mop-tests.lisp. Split into a separate file to |
---|
20 | ;;; avoid problems with the functions not being available during test |
---|
21 | ;;; runs. |
---|
22 | |
---|
23 | (in-package #:abcl.test.lisp) |
---|
24 | |
---|
25 | (defun find-classes (&rest args) |
---|
26 | (mapcar #'find-class args)) |
---|
27 | |
---|
28 | (defgeneric mop-test.foo (x y) |
---|
29 | (:method (x y) |
---|
30 | (list :object x :object y)) |
---|
31 | (:method ((x fixnum) y) |
---|
32 | (list :fixnum x :object y)) |
---|
33 | (:method ((x fixnum) (y fixnum)) |
---|
34 | (list :fixnum x :fixnum y))) |
---|
35 | |
---|
36 | (defun find-foo (&rest specializers) |
---|
37 | (find-method #'mop-test.foo nil |
---|
38 | (mapcar #'find-class specializers))) |
---|
39 | |
---|
40 | (defgeneric mop-test.bar (x y) |
---|
41 | (:method (x y) |
---|
42 | (list :object x :object y)) |
---|
43 | (:method ((x fixnum) y) |
---|
44 | (list :fixnum x :object y)) |
---|
45 | (:method ((x fixnum) (y fixnum)) |
---|
46 | (list :fixnum x :fixnum y)) |
---|
47 | (:method ((x fixnum) (y string)) |
---|
48 | (list :fixnum x :fixnum y)) |
---|
49 | (:method ((x fixnum) (y (eql 123))) |
---|
50 | (list :fixnum x :123 y))) |
---|
51 | |
---|
52 | (defun find-bar (&rest specializers) |
---|
53 | (find-method #'mop-test.bar nil |
---|
54 | (mapcar #'find-class specializers))) |
---|
55 | |
---|
56 | (defgeneric mop-test.baz (x y) |
---|
57 | (:method (x y) |
---|
58 | (list :object x :object y)) |
---|
59 | (:method ((x fixnum) y) |
---|
60 | (list :fixnum x :object y)) |
---|
61 | (:method ((x fixnum) (y fixnum)) |
---|
62 | (list :fixnum x :fixnum y)) |
---|
63 | (:method ((x (eql 234)) (y fixnum)) |
---|
64 | (list :234 x :fixnum y))) |
---|
65 | |
---|
66 | (defun find-baz (&rest specializers) |
---|
67 | (find-method #'mop-test.baz nil |
---|
68 | (mapcar #'find-class specializers))) |
---|
69 | |
---|
70 | (defgeneric mop-test.quux (x y) |
---|
71 | (:method (x y) |
---|
72 | (list :object x :object y)) |
---|
73 | (:method ((x fixnum) y) |
---|
74 | (list :fixnum x :object y)) |
---|
75 | (:method ((x fixnum) (y fixnum)) |
---|
76 | (list :fixnum x :fixnum y)) |
---|
77 | (:method ((x (eql :foo)) (y fixnum)) |
---|
78 | (list :foo x :fixnum y))) |
---|
79 | |
---|
80 | (defun find-quux (&rest specializers) |
---|
81 | (find-method #'mop-test.quux nil |
---|
82 | (mapcar #'find-class specializers))) |
---|