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 - in a category */
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 @implementation SubSubClass (Additions)
55 #include "class-tests-1.h"
56 #define TYPE_OF_OBJECT_WITH_ACCESSOR_METHOD SubClass *
57 #include "class-tests-2.h"
62 SubSubClass *sub_object;
64 test_class_with_superclass ("SubClass", "RootClass");
65 test_that_class_has_instance_method ("SubClass", @selector (setState:));
66 test_that_class_has_instance_method ("SubClass", @selector (state));
68 test_class_with_superclass ("SubSubClass", "SubClass");
69 test_that_class_has_instance_method ("SubSubClass", @selector (setState:));
70 test_that_class_has_instance_method ("SubSubClass", @selector (state));
72 object = class_create_instance (objc_lookup_class ("SubClass"));
73 test_accessor_method (object, 0, -1, -1, 1, 1);
75 sub_object = class_create_instance (objc_lookup_class ("SubSubClass"));
76 test_accessor_method (sub_object, 1, -1, 0, 1, 2);