@@ -21,10 +21,16 @@ #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 @@ -57,18 +63,18 @@ 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: SIZE_MAX - 128]) + OFOutOfMemoryException, [obj allocMemoryWithSize: TOO_BIG]) EXPECT_EXCEPTION(@"Detect out of memory on resize", OFOutOfMemoryException, { p = [obj allocMemoryWithSize: 1]; [obj resizeMemory: p - size: SIZE_MAX - 128]; + size: TOO_BIG]; }) [obj freeMemory: p]; TEST(@"Allocate when trying to resize NULL", (p = [obj resizeMemory: NULL