1 /* Contributed by Nicola Pero - Tue Mar 6 23:05:53 CET 2001 */
5 /* Tests creating a root class and a subclass with a class accessor
6 methods and a subclass overriding the superclass' implementation
7 but reusing it with super */
15 @implementation RootClass
16 + initialize { return self; }
19 static int class_variable = 0;
21 @interface SubClass : RootClass
22 + (void) setState: (int)number;
26 @implementation SubClass
27 + (void) setState: (int)number
29 class_variable = number;
33 return class_variable;
37 @interface SubSubClass : SubClass
40 @implementation SubSubClass
43 return [super state] + 1;
47 #include "class-tests-1.h"
48 #define TYPE_OF_OBJECT_WITH_ACCESSOR_METHOD Class
49 #include "class-tests-2.h"
56 test_class_with_superclass ("SubClass", "RootClass");
57 test_that_class_has_class_method ("SubClass", @selector (setState:));
58 test_that_class_has_class_method ("SubClass", @selector (state));
60 test_class_with_superclass ("SubSubClass", "SubClass");
61 test_that_class_has_class_method ("SubSubClass", @selector (setState:));
62 test_that_class_has_class_method ("SubSubClass", @selector (state));
64 class = objc_getClass ("SubClass");
65 test_accessor_method (class, 0, -1, -1, 1, 1);
67 sub_class = objc_getClass ("SubSubClass");
69 test_accessor_method (sub_class, 1, -1, 0, 1, 2);