6 #include <objc/runtime.h>
8 @interface Fake : TestRoot @end
9 @implementation Fake @end
13 TestRoot *obj = [TestRoot new];
14 Class __unsafe_unretained * buf = (Class *)(__bridge void *)(obj);
17 testassert(object_getClass(obj) == [Fake class]);
18 testassert(object_setClass(obj, [TestRoot class]) == [Fake class]);
19 testassert(object_getClass(obj) == [TestRoot class]);
20 testassert(object_setClass(nil, [TestRoot class]) == nil);
22 testassert(malloc_size(buf) >= sizeof(id));
23 bzero(buf, malloc_size(buf));
24 testassert(object_setClass(obj, [TestRoot class]) == nil);
26 testassert(object_getClass(obj) == [TestRoot class]);
27 testassert(object_getClass([TestRoot class]) == object_getClass([TestRoot class]));
28 testassert(object_getClass(nil) == Nil);
30 testassert(0 == strcmp(object_getClassName(obj), "TestRoot"));
31 testassert(0 == strcmp(object_getClassName([TestRoot class]), "TestRoot"));
32 testassert(0 == strcmp(object_getClassName(nil), "nil"));
34 testassert(0 == strcmp(class_getName([TestRoot class]), "TestRoot"));
35 testassert(0 == strcmp(class_getName(object_getClass([TestRoot class])), "TestRoot"));
36 testassert(0 == strcmp(class_getName(nil), "nil"));