49 |
*dmc-times* |
*dmc-times* |
50 |
times) |
times) |
51 |
|
|
52 |
|
(deftest define-method-combination-01.4 |
53 |
|
(let ((doc (documentation *dmc-times* 'method-combination))) |
54 |
|
(or (null doc) |
55 |
|
(equalt doc "Multiplicative method combination, version 1"))) |
56 |
|
t) |
57 |
|
|
58 |
(eval-when (:load-toplevel :compile-toplevel :execute) |
(eval-when (:load-toplevel :compile-toplevel :execute) |
59 |
(report-and-ignore-errors |
(report-and-ignore-errors |
60 |
(defgeneric dmc-gf-02 (x) (:method-combination times)) |
(defgeneric dmc-gf-02 (x) (:method-combination times)) |
140 |
(deftest define-method-combination-04.3 |
(deftest define-method-combination-04.3 |
141 |
(dmc-gf-04 'a) |
(dmc-gf-04 'a) |
142 |
nil) |
nil) |
143 |
|
|
144 |
|
(eval-when (:load-toplevel :compile-toplevel :execute) |
145 |
|
(report-and-ignore-errors |
146 |
|
(defvar *dmc-times-5* |
147 |
|
(define-method-combination times-5 :operator *)))) |
148 |
|
|
149 |
|
(deftest define-method-combination-05.1 |
150 |
|
(let* ((doc1 (setf (documentation *dmc-times-5* 'method-combination) |
151 |
|
"foo")) |
152 |
|
(doc2 (documentation *dmc-times-5* 'method-combination))) |
153 |
|
(values |
154 |
|
doc1 |
155 |
|
(or (null doc2) |
156 |
|
(equalt doc2 "foo")))) |
157 |
|
"foo" t) |
158 |
|
|
159 |
|
;; Operator name defaults to the method combination name. |
160 |
|
|
161 |
|
(eval-when (:load-toplevel :compile-toplevel :execute) |
162 |
|
(defun times-7 (&rest args) (apply #'* args)) |
163 |
|
(report-and-ignore-errors |
164 |
|
(defvar *dmc-times-7* |
165 |
|
(define-method-combination times-7)) |
166 |
|
(defgeneric dmc-gf-07 (x) (:method-combination times)) |
167 |
|
|
168 |
|
(defmethod dmc-gf-07 times ((x integer)) 2) |
169 |
|
(defmethod dmc-gf-07 times ((x rational)) 3) |
170 |
|
(defmethod dmc-gf-07 times ((x real)) 5) |
171 |
|
(defmethod dmc-gf-07 times ((x number)) 7) |
172 |
|
(defmethod dmc-gf-07 times ((x complex)) 11) |
173 |
|
)) |
174 |
|
|
175 |
|
(deftest define-method-combination-07.1 |
176 |
|
(values |
177 |
|
(dmc-gf-07 1) |
178 |
|
(dmc-gf-07 1/2) |
179 |
|
(dmc-gf-07 1.0) |
180 |
|
(dmc-gf-07 #c(1 2))) |
181 |
|
210 105 35 77) |