1 // TEST_CFLAGS -Wno-deprecated-declarations
3 #import <objc/runtime.h>
4 #import <objc/objc-auto.h>
8 static void* objc_collectableZone(void) { return NULL; }
9 static BOOL auto_zone_is_valid_pointer(void *a, void *b) { return a||b; }
13 @interface Super { @public id isa; } @end
15 +(void) initialize { }
16 +(Class) class { return self; }
19 @interface Sub : Super { int array[128]; } @end
20 @implementation Sub @end
26 s = class_createInstance([Super class], 0);
28 testassert(s->isa == [Super class]);
29 testassert(malloc_size(s) >= class_getInstanceSize([Super class]));
30 if (objc_collectingEnabled()) testassert(auto_zone_is_valid_pointer(objc_collectableZone(), s));
34 s = class_createInstance([Sub class], 0);
36 testassert(s->isa == [Sub class]);
37 testassert(malloc_size(s) >= class_getInstanceSize([Sub class]));
38 if (objc_collectingEnabled()) testassert(auto_zone_is_valid_pointer(objc_collectableZone(), s));
42 s = class_createInstance([Super class], 100);
44 testassert(s->isa == [Super class]);
45 testassert(malloc_size(s) >= class_getInstanceSize([Super class]) + 100);
46 if (objc_collectingEnabled()) testassert(auto_zone_is_valid_pointer(objc_collectableZone(), s));
50 s = class_createInstance([Sub class], 100);
52 testassert(s->isa == [Sub class]);
53 testassert(malloc_size(s) >= class_getInstanceSize([Sub class]) + 100);
54 if (objc_collectingEnabled()) testassert(auto_zone_is_valid_pointer(objc_collectableZone(), s));
58 s = class_createInstance(Nil, 0);