aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorArslaan Pathan <[email protected]>2026-10-02 21:30:02 +1300
committerArslaan Pathan <[email protected]>2026-10-02 21:30:02 +1300
commit5f84ceace671185ea8d823f587a26739ca07f92f (patch)
tree51872d7007e75ec44990585265c3ae18949988b9 /tests
parentaac41105140af8b506a1f7fd1ec902e7d95fb3a2 (diff)
downloadParadox-5f84ceace671185ea8d823f587a26739ca07f92f.tar.xz
Paradox-5f84ceace671185ea8d823f587a26739ca07f92f.zip
retain/release lifecycle stuff
Diffstat (limited to 'tests')
-rw-r--r--tests/Object.m28
1 files changed, 25 insertions, 3 deletions
diff --git a/tests/Object.m b/tests/Object.m
index be81b1d..2814489 100644
--- a/tests/Object.m
+++ b/tests/Object.m
@@ -2,7 +2,7 @@
#include <stdio.h>
int main(void) {
- printf("PXObject test\n");
+ printf("PXObject test (allocDebug)\n");
PXObject *object = [PXObject allocDebug];
@@ -18,9 +18,31 @@ int main(void) {
return 1;
}
- [object dealloc];
+ [object release];
- printf("If you got this far without segfaulting or crashing it means it allocated and initialized a PXObject, then deallocated it. Yayayayayay\n");
+ 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;
}