14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
*/
#include "config.h"
#import "TestsAppDelegate.h"
static OFString *const module = @"Runtime";
@interface OFObject (SuperTest)
- (id)superTest;
@end
@interface RuntimeTest: OFObject
{
|
>
|
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
*/
#include "config.h"
#import "TestsAppDelegate.h"
static OFString *const module = @"Runtime";
static void *testKey = &testKey;
@interface OFObject (SuperTest)
- (id)superTest;
@end
@interface RuntimeTest: OFObject
{
|
84
85
86
87
88
89
90
91
92
93
94
95
96
97
|
TEST(@"copy, nonatomic properties", [test.foo isEqual: foo] &&
test.foo != foo && test.foo.retainCount == 1)
test.bar = string;
TEST(@"retain, atomic properties",
test.bar == string && string.retainCount == 3)
#ifdef OF_OBJFW_RUNTIME
if (sizeof(uintptr_t) == 8)
value = 0xDEADBEEFDEADBEF;
else if (sizeof(uintptr_t) == 4)
value = 0xDEADBEF;
else
abort();
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
|
TEST(@"copy, nonatomic properties", [test.foo isEqual: foo] &&
test.foo != foo && test.foo.retainCount == 1)
test.bar = string;
TEST(@"retain, atomic properties",
test.bar == string && string.retainCount == 3)
TEST(@"Associated objects",
R(objc_setAssociatedObject(self, testKey, test,
OBJC_ASSOCIATION_ASSIGN)) && test.retainCount == 2 &&
R(objc_setAssociatedObject(self, testKey, test,
OBJC_ASSOCIATION_RETAIN)) && test.retainCount == 3 &&
objc_getAssociatedObject(self, testKey) == test &&
test.retainCount == 4 &&
R(objc_setAssociatedObject(self, testKey, test,
OBJC_ASSOCIATION_ASSIGN)) && test.retainCount == 3 &&
R(objc_setAssociatedObject(self, testKey, test,
OBJC_ASSOCIATION_RETAIN_NONATOMIC)) && test.retainCount == 4 &&
objc_getAssociatedObject(self, testKey) == test &&
test.retainCount == 4 &&
R(objc_removeAssociatedObjects(self)) && test.retainCount == 3)
#ifdef OF_OBJFW_RUNTIME
if (sizeof(uintptr_t) == 8)
value = 0xDEADBEEFDEADBEF;
else if (sizeof(uintptr_t) == 4)
value = 0xDEADBEF;
else
abort();
|