53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
TEST(@"+[arrayWithCArray:length:]",
(a[2] = [OFArray arrayWithCArray: c_ary
length: 3]) &&
[a[2] isEqual: a[1]])
TEST(@"-[description]",
[[a[0] description ]isEqual: @"(Foo, Bar, Baz)"])
TEST(@"-[addObject:]", R([m[0] addObject: c_ary[0]]) &&
R([m[0] addObject: c_ary[2]]))
TEST(@"-[addObject:atIndex:]", R([m[0] addObject: c_ary[1]
atIndex: 1]))
|
|
|
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
TEST(@"+[arrayWithCArray:length:]",
(a[2] = [OFArray arrayWithCArray: c_ary
length: 3]) &&
[a[2] isEqual: a[1]])
TEST(@"-[description]",
[[a[0] description ]isEqual: @"(\n\tFoo,\n\tBar,\n\tBaz\n)"])
TEST(@"-[addObject:]", R([m[0] addObject: c_ary[0]]) &&
R([m[0] addObject: c_ary[2]]))
TEST(@"-[addObject:atIndex:]", R([m[0] addObject: c_ary[1]
atIndex: 1]))
|
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
|
case 0:
return @"foo";
case 1:
return @"bar";
}
return nil;
}]) && [[m[0] description] isEqual: @"(foo, bar)"])
TEST(@"-[mappedArrayUsingBLock]",
[[[m[0] mappedArrayUsingBlock: ^ id (id obj, size_t idx) {
switch (idx) {
case 0:
return @"foobar";
case 1:
return @"qux";
}
return nil;
}] description] isEqual: @"(foobar, qux)"])
TEST(@"-[filteredArrayUsingBlock:]",
[[[m[0] filteredArrayUsingBlock: ^ BOOL (id obj, size_t idx) {
return ([obj isEqual: @"foo"] ? YES : NO);
}] description] isEqual: @"(foo)"])
#endif
[pool drain];
}
@end
|
|
|
|
|
|
|
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
|
case 0:
return @"foo";
case 1:
return @"bar";
}
return nil;
}]) && [[m[0] description] isEqual: @"(\n\tfoo,\n\tbar\n)"])
TEST(@"-[mappedArrayUsingBLock]",
[[[m[0] mappedArrayUsingBlock: ^ id (id obj, size_t idx) {
switch (idx) {
case 0:
return @"foobar";
case 1:
return @"qux";
}
return nil;
}] description] isEqual: @"(\n\tfoobar,\n\tqux\n)"])
TEST(@"-[filteredArrayUsingBlock:]",
[[[m[0] filteredArrayUsingBlock: ^ BOOL (id obj, size_t idx) {
return ([obj isEqual: @"foo"] ? YES : NO);
}] description] isEqual: @"(\n\tfoo\n)"])
#endif
[pool drain];
}
@end
|