1 /* Contributed by Nicola Pero - Tue Mar 6 23:05:53 CET 2001 */
5 /* Tests creating a root class and a subclass with an ivar and
6 accessor methods and a subclass overriding the superclass'
7 implementation, and using self to call another method of itself */
15 @implementation RootClass
16 + initialize { return self; }
19 @interface SubClass : RootClass
23 - (void) setState: (int)number;
27 @implementation SubClass
28 - (void) setState: (int)number
38 @interface SubSubClass : SubClass
42 @implementation SubSubClass
45 return state + [self shift];
53 #include "class-tests-1.h"
54 #define TYPE_OF_OBJECT_WITH_ACCESSOR_METHOD SubClass *
55 #include "class-tests-2.h"
60 SubSubClass *sub_object;
62 test_class_with_superclass ("SubClass", "RootClass");
63 test_that_class_has_instance_method ("SubClass", @selector (setState:));
64 test_that_class_has_instance_method ("SubClass", @selector (state));
66 test_class_with_superclass ("SubSubClass", "SubClass");
67 test_that_class_has_instance_method ("SubSubClass", @selector (setState:));
68 test_that_class_has_instance_method ("SubSubClass", @selector (state));
69 test_that_class_has_instance_method ("SubSubClass", @selector (shift));
71 object = class_createInstance (objc_getClass ("SubClass"), 0);
72 test_accessor_method (object, 0, -1, -1, 1, 1);
74 sub_object = class_createInstance (objc_getClass ("SubSubClass"), 0);
75 test_accessor_method (sub_object, 1, -1, 0, 1, 2);