Differences From Artifact [dd072d17db]:
- File tests/OFObjectTests.m — part of check-in [11d3d69a22] at 2012-06-10 13:28:05 on branch trunk — More API improvements. (user: js, size: 2784) [annotate] [blame] [check-ins using] [more...]
To Artifact [f82008a12d]:
- File
tests/OFObjectTests.m
— part of check-in
[83618d5a08]
at
2012-10-21 22:13:34
on branch trunk
— Fix a test on DragonFlyBSD.
DragonFlyBSD has problems with too big values passed to malloc() or
realloc(), thus, make them smaller on DragonFlyBSD. (user: js, size: 2898) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
19 20 21 22 23 24 25 26 27 28 29 30 31 32 | #import "OFString.h" #import "OFAutoreleasePool.h" #import "OFMemoryNotPartOfObjectException.h" #import "OFOutOfMemoryException.h" #import "TestsAppDelegate.h" static OFString *module = @"OFObject"; @interface MyObj: OFObject @end @implementation MyObj | > > > > > > | 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | #import "OFString.h" #import "OFAutoreleasePool.h" #import "OFMemoryNotPartOfObjectException.h" #import "OFOutOfMemoryException.h" #import "TestsAppDelegate.h" #if defined(__DragonFly__) && defined(__LP64__) # define TOO_BIG (SIZE_MAX / 3) #else # define TOO_BIG (SIZE_MAX - 128) #endif static OFString *module = @"OFObject"; @interface MyObj: OFObject @end @implementation MyObj |
︙ | ︙ | |||
55 56 57 58 59 60 61 | R([obj freeMemory: r])) tmp = [self allocMemoryWithSize: 1024]; EXPECT_EXCEPTION(@"Detect freeing of memory not allocated by object", OFMemoryNotPartOfObjectException, [obj freeMemory: tmp]) EXPECT_EXCEPTION(@"Detect out of memory on alloc", | | | | 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 | R([obj freeMemory: r])) tmp = [self allocMemoryWithSize: 1024]; EXPECT_EXCEPTION(@"Detect freeing of memory not allocated by object", OFMemoryNotPartOfObjectException, [obj freeMemory: tmp]) EXPECT_EXCEPTION(@"Detect out of memory on alloc", OFOutOfMemoryException, [obj allocMemoryWithSize: TOO_BIG]) EXPECT_EXCEPTION(@"Detect out of memory on resize", OFOutOfMemoryException, { p = [obj allocMemoryWithSize: 1]; [obj resizeMemory: p size: TOO_BIG]; }) [obj freeMemory: p]; TEST(@"Allocate when trying to resize NULL", (p = [obj resizeMemory: NULL size: 1024]) != NULL) [obj freeMemory: p]; |
︙ | ︙ |