]> git.saurik.com Git - apple/objc4.git/blob - test/realizedClassGenerationCount.m
objc4-779.1.tar.gz
[apple/objc4.git] / test / realizedClassGenerationCount.m
1 // TEST_CONFIG
2
3 #include "test.h"
4 #include "testroot.i"
5
6 #include <dlfcn.h>
7
8 extern uintptr_t objc_debug_realized_class_generation_count;
9
10 int main()
11 {
12 testassert(objc_debug_realized_class_generation_count > 0);
13 uintptr_t prev = objc_debug_realized_class_generation_count;
14
15 void *handle = dlopen("/System/Library/Frameworks/Foundation.framework/Foundation", RTLD_LAZY);
16 testassert(handle);
17 Class c = objc_getClass("NSFileManager");
18 testassert(c);
19 testassert(objc_debug_realized_class_generation_count > prev);
20
21 prev = objc_debug_realized_class_generation_count;
22 c = objc_allocateClassPair([TestRoot class], "Dynamic", 0);
23 testassert(objc_debug_realized_class_generation_count > prev);
24 prev = objc_debug_realized_class_generation_count;
25 objc_registerClassPair(c);
26 testassert(objc_debug_realized_class_generation_count == prev);
27
28 succeed(__FILE__);
29 }