1 // TEST_CONFIG MEM=mrc,gc
2 // TEST_CFLAGS -Wno-deprecated-declarations
4 #import <objc/runtime.h>
5 #import <objc/objc-auto.h>
9 static void* objc_collectableZone(void) { return NULL; }
10 static BOOL auto_zone_is_valid_pointer(void *a, void *b) { return a||b; }
14 @interface Super { @public id isa; } @end
16 +(void) initialize { }
17 +(Class) class { return self; }
20 @interface Sub : Super { int array[128]; } @end
21 @implementation Sub @end
27 s = class_createInstance([Super class], 0);
29 testassert(s->isa == [Super class]);
30 testassert(malloc_size(s) >= class_getInstanceSize([Super class]));
31 if (objc_collectingEnabled()) testassert(auto_zone_is_valid_pointer(objc_collectableZone(), s));
35 s = class_createInstance([Sub class], 0);
37 testassert(s->isa == [Sub class]);
38 testassert(malloc_size(s) >= class_getInstanceSize([Sub class]));
39 if (objc_collectingEnabled()) testassert(auto_zone_is_valid_pointer(objc_collectableZone(), s));
43 s = class_createInstance([Super class], 100);
45 testassert(s->isa == [Super class]);
46 testassert(malloc_size(s) >= class_getInstanceSize([Super class]) + 100);
47 if (objc_collectingEnabled()) testassert(auto_zone_is_valid_pointer(objc_collectableZone(), s));
51 s = class_createInstance([Sub class], 100);
53 testassert(s->isa == [Sub class]);
54 testassert(malloc_size(s) >= class_getInstanceSize([Sub class]) + 100);
55 if (objc_collectingEnabled()) testassert(auto_zone_is_valid_pointer(objc_collectableZone(), s));
59 s = class_createInstance(Nil, 0);