1 // TEST_CONFIG MEM=mrc,gc
4 #include <objc/NSObject.h>
6 @interface Test : NSObject {
8 char bytes[32-sizeof(void*)];
17 Test *o0 = [Test new];
19 Test *o1 = class_createInstance([Test class], 32);
21 id o2 = object_copy(o0, 0);
22 id o3 = object_copy(o1, 0);
23 id o4 = object_copy(o1, 32);
24 testassert(malloc_size(o0) == 32);
25 testassert(malloc_size(o1) == 64);
26 testassert(malloc_size(o2) == 32);
27 testassert(malloc_size(o3) == 32);
28 testassert(malloc_size(o4) == 64);
29 if (!objc_collecting_enabled()) {
30 testassert([o0 retainCount] == 2);
31 testassert([o1 retainCount] == 2);
32 testassert([o2 retainCount] == 1);
33 testassert([o3 retainCount] == 1);
34 testassert([o4 retainCount] == 1);