/[gcl]/gcl/ansi-tests/define-method-combination.lsp
ViewVC logotype

Diff of /gcl/ansi-tests/define-method-combination.lsp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.3 by pfdietz, Tue Jun 17 13:24:39 2003 UTC revision 1.4 by pfdietz, Sat Jul 12 13:46:01 2003 UTC
# Line 14  Line 14 
14  (defclass dmc-class-01g (dmc-class-01a) ())  (defclass dmc-class-01g (dmc-class-01a) ())
15  (defclass dmc-class-01h (dmc-class-01f dmc-class-01g) ())  (defclass dmc-class-01h (dmc-class-01f dmc-class-01g) ())
16    
17  (defvar *dmc-times*  (eval-when (:load-toplevel :compile-toplevel :execute)
18    (define-method-combination times    (report-and-ignore-errors
19      :documentation "Multiplicative method combination, version 1"     (defvar *dmc-times*
20      :operator *))       (define-method-combination times
21           :documentation "Multiplicative method combination, version 1"
22  (defgeneric dmc-gf-01 (x) (:method-combination times))         :operator *))
23      
24  (defmethod dmc-gf-01 times ((x integer)) 2)     (defgeneric dmc-gf-01 (x) (:method-combination times))
25  (defmethod dmc-gf-01 times ((x rational)) 3)    
26  (defmethod dmc-gf-01 times ((x real)) 5)     (defmethod dmc-gf-01 times ((x integer)) 2)
27  (defmethod dmc-gf-01 times ((x number)) 7)     (defmethod dmc-gf-01 times ((x rational)) 3)
28  (defmethod dmc-gf-01 times ((x complex)) 11)     (defmethod dmc-gf-01 times ((x real)) 5)
29       (defmethod dmc-gf-01 times ((x number)) 7)
30       (defmethod dmc-gf-01 times ((x complex)) 11)
31       ))
32    
33  (deftest define-method-combination-01.1  (deftest define-method-combination-01.1
34    (values    (values
# Line 46  Line 49 
49    *dmc-times*    *dmc-times*
50    times)    times)
51    
52  (defgeneric dmc-gf-02 (x) (:method-combination times))  (eval-when (:load-toplevel :compile-toplevel :execute)
53      (report-and-ignore-errors
54  (defmethod dmc-gf-02 times ((x integer)) 2)     (defgeneric dmc-gf-02 (x) (:method-combination times))
55  (defmethod dmc-gf-02 :around ((x rational)) (1- (call-next-method)))    
56  (defmethod dmc-gf-02 times ((x real)) 3)     (defmethod dmc-gf-02 times ((x integer)) 2)
57  (defmethod dmc-gf-02 times ((x number)) 5)     (defmethod dmc-gf-02 :around ((x rational)) (1- (call-next-method)))
58  (defmethod dmc-gf-02 :around ((x (eql 1.0s0))) 1)     (defmethod dmc-gf-02 times ((x real)) 3)
59       (defmethod dmc-gf-02 times ((x number)) 5)
60       (defmethod dmc-gf-02 :around ((x (eql 1.0s0))) 1)
61       ))
62    
63  (deftest define-method-combination-02.1  (deftest define-method-combination-02.1
64    (values    (values
# Line 63  Line 69 
69     (dmc-gf-02 #c(1 2)))     (dmc-gf-02 #c(1 2)))
70    29 14 1 15 5)    29 14 1 15 5)
71    
72  (defgeneric dmc-gf-03 (x) (:method-combination times))  (eval-when (:load-toplevel :compile-toplevel :execute)
73      (report-and-ignore-errors
74       (defgeneric dmc-gf-03 (x) (:method-combination times))))
75    
76  (deftest define-method-combination-03.1  (deftest define-method-combination-03.1
77    (prog1    (prog1
# Line 101  Line 109 
109        (remove-method #'dmc-gf-03 meth)))        (remove-method #'dmc-gf-03 meth)))
110    :good)    :good)
111    
112  (define-method-combination times2  (eval-when (:load-toplevel :compile-toplevel :execute)
113    :operator *    (report-and-ignore-errors
114    :identity-with-one-argument t)     (define-method-combination times2
115         :operator *
116  (defgeneric dmc-gf-04 (x) (:method-combination times2))       :identity-with-one-argument t)
117      
118  (defmethod dmc-gf-04 times2 ((x dmc-class-01b)) 2)     (defgeneric dmc-gf-04 (x) (:method-combination times2))
119  (defmethod dmc-gf-04 times2 ((x dmc-class-01c)) 3)    
120  (defmethod dmc-gf-04 times2 ((x dmc-class-01d)) 5)     (defmethod dmc-gf-04 times2 ((x dmc-class-01b)) 2)
121  (defmethod dmc-gf-04 times2 ((x symbol)) nil)     (defmethod dmc-gf-04 times2 ((x dmc-class-01c)) 3)
122       (defmethod dmc-gf-04 times2 ((x dmc-class-01d)) 5)
123       (defmethod dmc-gf-04 times2 ((x symbol)) nil)
124       ))
125    
126  (deftest define-method-combination-04.1  (deftest define-method-combination-04.1
127    (dmc-gf-04 (make-instance 'dmc-class-01h))    (dmc-gf-04 (make-instance 'dmc-class-01h))

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.4

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26