1/* Contributed by Nicola Pero - Tue Mar 6 23:05:53 CET 2001 */ 2#include <objc/objc.h> 3#include <objc/objc-api.h> 4 5/* Tests creating a root class and a subclass with an ivar and 6 accessor methods */ 7 8@interface RootClass 9{ 10 Class isa; 11} 12@end 13 14@implementation RootClass 15@end 16 17@interface SubClass : RootClass 18{ 19 int state; 20} 21- (void) setState: (int)number; 22- (int) state; 23@end 24 25@implementation SubClass 26- (void) setState: (int)number 27{ 28 state = number; 29} 30- (int) state 31{ 32 return state; 33} 34@end 35 36#include "class-tests-1.h" 37#define TYPE_OF_OBJECT_WITH_ACCESSOR_METHOD SubClass * 38#include "class-tests-2.h" 39 40int main (void) 41{ 42 SubClass *object; 43 44 test_class_with_superclass ("SubClass", "RootClass"); 45 test_that_class_has_instance_method ("SubClass", @selector (setState:)); 46 test_that_class_has_instance_method ("SubClass", @selector (state)); 47 48 object = class_create_instance (objc_lookup_class ("SubClass")); 49 test_accessor_method (object, 0, 1, 1, -3, -3); 50 51 return 0; 52} 53