22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
object_tests()
{
OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init];
OFObject *obj = [[[OFObject alloc] init] autorelease];
void *p, *q, *r;
EXPECT_EXCEPTION(@"Detect freeing of memory not allocated by object",
OFMemoryNotPartOfObjectException, [obj freeMemory: NULL])
TEST(@"Allocating 4096 bytes",
(p = [obj allocMemoryWithSize: 4096]) != NULL)
TEST(@"Freeing memory", [obj freeMemory: p])
EXPECT_EXCEPTION(@"Detect freeing of memory twice",
|
|
|
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
object_tests()
{
OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init];
OFObject *obj = [[[OFObject alloc] init] autorelease];
void *p, *q, *r;
EXPECT_EXCEPTION(@"Detect freeing of memory not allocated by object",
OFMemoryNotPartOfObjectException, [obj freeMemory: (void*)1])
TEST(@"Allocating 4096 bytes",
(p = [obj allocMemoryWithSize: 4096]) != NULL)
TEST(@"Freeing memory", [obj freeMemory: p])
EXPECT_EXCEPTION(@"Detect freeing of memory twice",
|