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 and using self to call another method of itself - in
18 @implementation RootClass
19 #ifdef __NEXT_RUNTIME__
20 + initialize { return self; }
24 @interface SubClass : RootClass
28 - (void) setState: (int)number;
32 @implementation SubClass
33 - (void) setState: (int)number
43 @interface SubSubClass : SubClass
47 @implementation SubSubClass
54 @implementation SubSubClass (Additions)
57 return state + [self shift];
61 #include "class-tests-1.h"
62 #define TYPE_OF_OBJECT_WITH_ACCESSOR_METHOD SubClass *
63 #include "class-tests-2.h"
68 SubSubClass *sub_object;
70 test_class_with_superclass ("SubClass", "RootClass");
71 test_that_class_has_instance_method ("SubClass", @selector (setState:));
72 test_that_class_has_instance_method ("SubClass", @selector (state));
74 test_class_with_superclass ("SubSubClass", "SubClass");
75 test_that_class_has_instance_method ("SubSubClass", @selector (setState:));
76 test_that_class_has_instance_method ("SubSubClass", @selector (state));
77 test_that_class_has_instance_method ("SubSubClass", @selector (shift));
79 object = class_create_instance (objc_lookup_class ("SubClass"));
80 test_accessor_method (object, 0, -1, -1, 1, 1);
82 sub_object = class_create_instance (objc_lookup_class ("SubSubClass"));
83 test_accessor_method (sub_object, 1, -1, 0, 1, 2);