blob: dda917121d59836ce22940675c1455e4b89d172f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
#include <Paradox/Core.h>
#include <stdio.h>
int main(void) {
printf("PXObject test ");
#ifdef PARADOX_DEBUG_FEATURES
printf("(allocDebug)\n");
#else
printf("(alloc)\n");
printf("Note: Paradox compiled without debug features, using alloc instead of allocDebug\n");
#endif
#ifdef PARADOX_DEBUG_FEATURES
PXObject *object = [PXObject allocDebug];
#else
PXObject *object = [PXObject alloc];
#endif
if (object == nil) {
fprintf(stderr, "PXObject failed to alloc :c\n");
return 1;
}
object = [object init];
if (object == nil) {
fprintf(stderr, "PXObject failed to init :c\n");
return 1;
}
[object release];
printf("If you got this far without segfaulting or crashing it means it allocated and initialized a PXObject, then released it. Yay!\n");
printf("\nPXObject two-owner test (new)\n");
PXObject *object1 = [PXObject new];
PXObject *object2 = [object1 retain];
printf("object1 reference: %p\n", (void*)object1);
[object1 release];
printf("object1 released\n");
printf("attempting retain on object2\n");
PXObject *object3 = [object2 retain];
printf("object2 reference: %p\n", (void*)object2);
[object2 release];
printf("object2 released\n");
printf("object3 reference: %p\n", (void*)object3);
[object3 release];
printf("object3 released\n");
printf("test complete\n");
return 0;
}
|