Differences From Artifact [95c48806f0]:
- File
tests/OFArray/OFArray.m
— part of check-in
[61a6ac873a]
at
2009-02-14 17:08:21
on branch trunk
— Big diff, see details.
* Add OFComparable protocol.
* Add OFInvalidArgument exception - needs that sel_getName vs.
sel_get_name stuff again, therefore reintroduce it.
* Implement proper copy method for OFString and OFArray.
* Add isEqual: and compare: for OFString and OFArray. (user: js, size: 3970) [annotate] [blame] [check-ins using]
To Artifact [c4671d9ef0]:
- File tests/OFArray/OFArray.m — part of check-in [ffd26c8238] at 2009-02-27 11:17:54 on branch trunk — Add - hash for OFArray and OFString, main implementation in OFMacros. (user: js, size: 4100) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
131 132 133 134 135 136 137 138 139 140 | x = [OFArray arrayWithItemSize: 1]; y = [OFArray bigArrayWithItemSize: 1]; if (![x isEqual: y]) { puts("FAIL 1!"); return 1; } [x add: "x"]; if ([x isEqual: y]) { | > > > > > | | | | | > > > > > | 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 | x = [OFArray arrayWithItemSize: 1]; y = [OFArray bigArrayWithItemSize: 1]; if (![x isEqual: y]) { puts("FAIL 1!"); return 1; } if ([x hash] != [y hash]) { puts("FAIL 2!"); return 1; } [x add: "x"]; if ([x isEqual: y]) { puts("FAIL 3!"); return 1; } [pool releaseObjects]; x = [OFArray arrayWithItemSize: 2]; y = [OFArray bigArrayWithItemSize: 4]; if ([x isEqual: y]) { puts("FAIL 4!"); return 1; } [pool releaseObjects]; x = [OFArray arrayWithItemSize: 1]; [x addNItems: 3 fromCArray: "abc"]; y = [x copy]; if ([x compare: y]) { puts("FAIL 5!"); return 1; } [y add: "de"]; if ([x compare: y] != -100) { puts("FAIL 6!"); return 1; } if ([y hash] != 0xCD8B6206) { puts("FAIL 7!"); return 1; } [pool release]; return 0; } |