Differences From Artifact [875bad3799]:
- File tests/OFObject/OFObject.m — part of check-in [f1b749d113] at 2009-01-05 00:59:06 on branch trunk — Update copyright. (user: js, size: 2717) [annotate] [blame] [check-ins using]
To Artifact [5969f41bb6]:
- File
tests/OFObject/OFObject.m
— part of check-in
[e959fed010]
at
2009-04-26 12:44:20
on branch trunk
— A few renames in OFObject.
getMemWithSize: -> allocWithSize:
getMemForNItems:ofSize: -> allocNItems:withSize:
resizeMem:toNItems:ofSize: -> resizeMem:toNItems:withSize: (user: js, size: 2711) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
39 40 41 42 43 44 45 | /* Test freeing memory not allocated by obj */ puts("Freeing memory not allocated by object (should throw an " "exception)..."); CATCH_EXCEPTION([obj freeMem: NULL], OFMemNotPartOfObjException) /* Test allocating memory */ puts("Allocating memory through object..."); | | | | | | | | 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 | /* Test freeing memory not allocated by obj */ puts("Freeing memory not allocated by object (should throw an " "exception)..."); CATCH_EXCEPTION([obj freeMem: NULL], OFMemNotPartOfObjException) /* Test allocating memory */ puts("Allocating memory through object..."); p = [obj allocWithSize: 4096]; puts("Allocated 4096 bytes."); /* Test freeing the just allocated memory */ puts("Freeing just allocated memory..."); [obj freeMem: p]; puts("Free'd."); /* It shouldn't be recognized as part of our obj anymore */ puts("Trying to free it again (should throw an exception)..."); CATCH_EXCEPTION([obj freeMem: p], OFMemNotPartOfObjException) /* Test multiple memory chunks */ puts("Allocating 3 chunks of memory..."); p = [obj allocWithSize: 4096]; q = [obj allocWithSize: 4096]; r = [obj allocWithSize: 4096]; puts("Allocated 3 * 4096 bytes."); /* Free them */ puts("Now freeing them..."); [obj freeMem: p]; [obj freeMem: q]; [obj freeMem: r]; puts("Freed them all."); /* Try to free again */ puts("Now trying to free them again..."); CATCH_EXCEPTION([obj freeMem: p], OFMemNotPartOfObjException) CATCH_EXCEPTION([obj freeMem: q], OFMemNotPartOfObjException) CATCH_EXCEPTION([obj freeMem: r], OFMemNotPartOfObjException) puts("Got all 3!"); puts("Trying to allocate more memory than possible..."); CATCH_EXCEPTION(p = [obj allocWithSize: SIZE_MAX], OFNoMemException) puts("Allocating 1 byte..."); p = [obj allocWithSize: 1]; puts("Trying to resize that 1 byte to more than possible..."); CATCH_EXCEPTION(p = [obj resizeMem: p toSize: SIZE_MAX], OFNoMemException) puts("Trying to resize NULL to 1024 bytes..."); |
︙ | ︙ |