1 /* Contributed by Nicola Pero - Tue Mar 6 23:05:53 CET 2001 */
3 #include <objc/objc-api.h>
5 #include "next_mapping.h"
7 /* Tests creating a root class and a subclass with an ivar and
8 accessor methods and a subclass overriding the superclass'
9 implementation but reusing it with super */
17 @implementation RootClass
18 #ifdef __NEXT_RUNTIME__
19 + initialize { return self; }
23 @interface SubClass : RootClass
27 - (void) setState: (int)number;
31 @implementation SubClass
32 - (void) setState: (int)number
42 @interface SubSubClass : SubClass
45 @implementation SubSubClass
48 return [super state] + 1;
52 #include "class-tests-1.h"
53 #define TYPE_OF_OBJECT_WITH_ACCESSOR_METHOD SubClass *
54 #include "class-tests-2.h"
59 SubSubClass *sub_object;
61 test_class_with_superclass ("SubClass", "RootClass");
62 test_that_class_has_instance_method ("SubClass", @selector (setState:));
63 test_that_class_has_instance_method ("SubClass", @selector (state));
65 test_class_with_superclass ("SubSubClass", "SubClass");
66 test_that_class_has_instance_method ("SubSubClass", @selector (setState:));
67 test_that_class_has_instance_method ("SubSubClass", @selector (state));
69 object = class_create_instance (objc_lookup_class ("SubClass"));
70 test_accessor_method (object, 0, -1, -1, 1, 1);
72 sub_object = class_create_instance (objc_lookup_class ("SubSubClass"));
73 test_accessor_method (sub_object, 1, -1, 0, 1, 2);