1 /* Contributed by Nicola Pero - Tue Mar 6 23:05:53 CET 2001 */
3 #include <objc/objc-api.h>
5 /* Tests creating a root class and a subclass with an ivar and
6 accessor methods and a subclass overriding the superclass'
7 implementation but reusing it with super - in a category */
15 @implementation RootClass
18 @interface SubClass : RootClass
22 - (void) setState: (int)number;
26 @implementation SubClass
27 - (void) setState: (int)number
37 @interface SubSubClass : SubClass
40 @implementation SubSubClass
43 @implementation SubSubClass (Additions)
46 return [super state] + 1;
50 #include "class-tests-1.h"
51 #define TYPE_OF_OBJECT_WITH_ACCESSOR_METHOD SubClass *
52 #include "class-tests-2.h"
57 SubSubClass *sub_object;
59 test_class_with_superclass ("SubClass", "RootClass");
60 test_that_class_has_instance_method ("SubClass", @selector (setState:));
61 test_that_class_has_instance_method ("SubClass", @selector (state));
63 test_class_with_superclass ("SubSubClass", "SubClass");
64 test_that_class_has_instance_method ("SubSubClass", @selector (setState:));
65 test_that_class_has_instance_method ("SubSubClass", @selector (state));
67 object = class_create_instance (objc_lookup_class ("SubClass"));
68 test_accessor_method (object, 0, -1, -1, 1, 1);
70 sub_object = class_create_instance (objc_lookup_class ("SubSubClass"));
71 test_accessor_method (sub_object, 1, -1, 0, 1, 2);