1 ;;;; miscellaneous side-effectful tests of the MOP
3 ;;;; This software is part of the SBCL system. See the README file for
6 ;;;; While most of SBCL is derived from the CMU CL system, the test
7 ;;;; files (like this one) were written from scratch after the fork
10 ;;;; This software is in the public domain and is provided with
11 ;;;; absolutely no warranty. See the COPYING and CREDITS files for
12 ;;;; more information.
14 ;;; this file attempts to test possible metacircularity issues arising
15 ;;; from adding slots to methods in odd places.
17 (defclass super-method
()
18 ((abc :accessor abc
:initarg
:abc
)))
20 ;;; Test case reported by Jean Bresson sbcl-devel 2006-02-09
21 (defclass sub-generic-function1
(standard-generic-function) ()
22 (:metaclass sb-mop
:funcallable-standard-class
))
24 (defclass sub-method1
(standard-method super-method
) ())
26 (defgeneric myfun1
(a b
)
27 (:generic-function-class sub-generic-function1
)
28 (:method-class sub-method1
))
32 (defmethod myfun1 (a b
)
35 (with-test (:name
(:mop-12
1))
37 (assert (= *count1
* 1))
39 (assert (= *count1
* 2)))
41 (defmethod myfun1 ((a integer
) (b integer
))
44 (with-test (:name
(:mop-12
2))
46 (assert (= *count1
* 4))
48 (assert (= *count1
* 5)))
50 ;;; Friendlier superclass order test case from Pascal Costanza
51 ;;; sbcl-devel 2006-02-09
52 (defclass sub-generic-function2
(standard-generic-function) ()
53 (:metaclass sb-mop
:funcallable-standard-class
))
55 (defclass sub-method2
(super-method standard-method
) ())
57 (defgeneric myfun2
(a b
)
58 (:generic-function-class sub-generic-function2
)
59 (:method-class sub-method2
))
63 (defmethod myfun2 (a b
)
66 (with-test (:name
(:mop-12
3))
68 (assert (= *count2
* 1))
70 (assert (= *count2
* 2)))
72 (defmethod myfun2 ((a integer
) (b integer
))
75 (with-test (:name
(:mop-12
4))
77 (assert (= *count2
* 4))
79 (assert (= *count2
* 5)))