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; }
15 @interface Super { @public id isa; } @end
17 +(void) initialize { }
18 +(Class) class { return self; }
21 @interface Sub : Super { int array[128]; } @end
22 @implementation Sub @end
28 s = class_createInstance([Super class], 0);
30 testassert(object_getClass(s) == [Super class]);
31 testassert(malloc_size(s) >= class_getInstanceSize([Super class]));
32 if (objc_collectingEnabled()) testassert(auto_zone_is_valid_pointer(objc_collectableZone(), s));
36 s = class_createInstance([Sub class], 0);
38 testassert(object_getClass(s) == [Sub class]);
39 testassert(malloc_size(s) >= class_getInstanceSize([Sub class]));
40 if (objc_collectingEnabled()) testassert(auto_zone_is_valid_pointer(objc_collectableZone(), s));
44 s = class_createInstance([Super class], 100);
46 testassert(object_getClass(s) == [Super class]);
47 testassert(malloc_size(s) >= class_getInstanceSize([Super class]) + 100);
48 if (objc_collectingEnabled()) testassert(auto_zone_is_valid_pointer(objc_collectableZone(), s));
52 s = class_createInstance([Sub class], 100);
54 testassert(object_getClass(s) == [Sub class]);
55 testassert(malloc_size(s) >= class_getInstanceSize([Sub class]) + 100);
56 if (objc_collectingEnabled()) testassert(auto_zone_is_valid_pointer(objc_collectableZone(), s));
60 s = class_createInstance(Nil, 0);