Differences From Artifact [6aad159bdb]:
- File
tests/OFDataArray/OFDataArray.m
— part of check-in
[a29d403286]
at
2009-05-23 16:50:44
on branch trunk
— A few renames in OFArray, OFDataArray and OFDictionary.
OFArray:
* Rename - object: to - objectAtIndex:.OFDataArray:
* Rename - item: to - itemAtIndex:.OFDictionary:
* Rename - get: to - objectForKey:.
* Rename - set:to: to - setObject:forKey:.
* Rename - remove: to - removeObjectForKey:. (user: js, size: 4255) [annotate] [blame] [check-ins using]
To Artifact [ec34977a16]:
- File
tests/OFDataArray/OFDataArray.m
— part of check-in
[526d04018d]
at
2009-05-23 21:53:20
on branch trunk
— A few renames.
OFArray:
* -[add:] to -[addObject:].
* -[last] to -[lastObject].OFAutoreleasePool:
* +[addToPool:] to +[addObjectToTopmostPool:].
* -[addToPool:] to -[addObject:].OFDataArray:
* -[add:] to -[addItem:].
* -[last] to -[lastItem].OFObject:
* -[addToMemoryPool:] to -[addItemToMemoryPool:]. (user: js, size: 4310) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
40 41 42 43 44 45 46 | CATCH_EXCEPTION([a addNItems: SIZE_MAX \ fromCArray: NULL], \ OFOutOfRangeException) \ \ puts("Trying to add something after that error..."); \ p = [a allocWithSize: 4096]; \ memset(p, 255, 4096); \ | | | | | | | | | | | | | | | 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 | CATCH_EXCEPTION([a addNItems: SIZE_MAX \ fromCArray: NULL], \ OFOutOfRangeException) \ \ puts("Trying to add something after that error..."); \ p = [a allocWithSize: 4096]; \ memset(p, 255, 4096); \ [a addItem: p]; \ if (!memcmp([a lastItem], p, 4096)) \ puts("[a lastItem] matches with p!"); \ else { \ puts("[a lastItem] does not match p!"); \ abort(); \ } \ [a freeMem: p]; \ \ puts("Adding more data..."); \ q = [a allocWithSize: 4096]; \ memset(q, 42, 4096); \ [a addItem: q]; \ if (!memcmp([a lastItem], q, 4096)) \ puts("[a lastItem] matches with q!"); \ else { \ puts("[a lastItem] does not match q!"); \ abort(); \ } \ [a freeMem: q]; \ \ puts("Adding multiple items at once..."); \ p = [a allocWithSize: 8192]; \ memset(p, 64, 8192); \ [a addNItems: 2 \ fromCArray: p]; \ if (!memcmp([a lastItem], [a itemAtIndex: [a count] - 2], 4096) && \ !memcmp([a itemAtIndex: [a count] - 2], p, 4096)) \ puts("[a lastItem], [a itemAtIndex: [a count] - 2] " \ "and p match!"); \ else { \ puts("[a lastItem], [a itemAtIndex: [a count] - 2] " \ "and p do not match!"); \ abort(); \ } \ [a freeMem: p]; \ \ i = [a count]; \ puts("Removing 2 items..."); \ [a removeNItems: 2]; \ |
︙ | ︙ | |||
99 100 101 102 103 104 105 | \ [a release]; \ \ puts("Creating new array and using it to build a string..."); \ a = [[type alloc] initWithItemSize: 1]; \ \ for (i = 0; i < strlen(str); i++) \ | | | | 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 | \ [a release]; \ \ puts("Creating new array and using it to build a string..."); \ a = [[type alloc] initWithItemSize: 1]; \ \ for (i = 0; i < strlen(str); i++) \ [a addItem: (void*)&str[i]]; \ [a addItem: ""]; \ \ if (!strcmp([a data], str)) \ puts("Built string matches!"); \ else { \ puts("Built string does not match!"); \ abort(); \ } \ |
︙ | ︙ | |||
140 141 142 143 144 145 146 | } if ([x hash] != [y hash]) { puts("FAIL 2!"); return 1; } | | | 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 | } if ([x hash] != [y hash]) { puts("FAIL 2!"); return 1; } [x addItem: "x"]; if ([x isEqual: y]) { puts("FAIL 3!"); return 1; } [pool releaseObjects]; x = [OFDataArray dataArrayWithItemSize: 2]; |
︙ | ︙ | |||
165 166 167 168 169 170 171 | fromCArray: "abc"]; y = [x copy]; if ([x compare: y]) { puts("FAIL 5!"); return 1; } | | | 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 | fromCArray: "abc"]; y = [x copy]; if ([x compare: y]) { puts("FAIL 5!"); return 1; } [y addItem: "de"]; if ([x compare: y] != -100) { puts("FAIL 6!"); return 1; } if ([y hash] != 0xCD8B6206) { puts("FAIL 7!"); return 1; } [pool release]; return 0; } |