Differences From Artifact [0b1404de72]:
- File tests/OFArray/OFArray.m — part of check-in [1496808b81] at 2009-01-24 15:24:49 on branch trunk — Adjust API to introduction of OFAutoreleasePool. (user: js, size: 3221) [annotate] [blame] [check-ins using]
To 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]
︙ | ︙ | |||
14 15 16 17 18 19 20 21 22 23 24 25 26 27 | #import <stdio.h> #import <stdlib.h> #import <string.h> #import <limits.h> #import "OFArray.h" #import "OFExceptions.h" #define CATCH_EXCEPTION(code, exception) \ @try { \ code; \ \ puts("NOT CAUGHT!"); \ return 1; \ | > | 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | #import <stdio.h> #import <stdlib.h> #import <string.h> #import <limits.h> #import "OFArray.h" #import "OFExceptions.h" #import "OFAutoreleasePool.h" #define CATCH_EXCEPTION(code, exception) \ @try { \ code; \ \ puts("NOT CAUGHT!"); \ return 1; \ |
︙ | ︙ | |||
113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 | int main() { id a; void *p, *q; size_t i; puts("== TESTING OFArray =="); TEST(OFArray) puts("== TESTING OFBigArray =="); TEST(OFBigArray) return 0; } | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 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 | int main() { id a; void *p, *q; size_t i; OFArray *x, *y; OFAutoreleasePool *pool; puts("== TESTING OFArray =="); TEST(OFArray) puts("== TESTING OFBigArray =="); TEST(OFBigArray) pool = [OFAutoreleasePool new]; x = [OFArray arrayWithItemSize: 1]; y = [OFArray bigArrayWithItemSize: 1]; if (![x isEqual: y]) { puts("FAIL 1!"); return 1; } [x add: "x"]; if ([x isEqual: y]) { puts("FAIL 2!"); return 2; } [pool releaseObjects]; x = [OFArray arrayWithItemSize: 2]; y = [OFArray bigArrayWithItemSize: 4]; if ([x isEqual: y]) { puts("FAIL 3!"); return 1; } [pool releaseObjects]; x = [OFArray arrayWithItemSize: 1]; [x addNItems: 3 fromCArray: "abc"]; y = [x copy]; if ([x compare: y]) { puts("FAIL 4!"); return 1; } [y add: "de"]; if ([x compare: y] != -100) { puts("FAIL 5!"); return 1; } [pool release]; return 0; } |