178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
|
TEST(@"-[indexOfObject:]", [a[0] indexOfObject: c_ary[1]] == 1)
TEST(@"-[indexOfObjectIdenticalTo:]",
[a[1] indexOfObjectIdenticalTo: c_ary[1]] == 1)
TEST(@"-[objectsInRange:]",
[[a[0] objectsInRange: OFMakeRange(1, 2)] isEqual:
[arrayClass arrayWithObjects: c_ary[1], c_ary[2], nil]])
TEST(@"-[replaceObject:withObject:]",
R([m[0] replaceObject: c_ary[1] withObject: c_ary[0]]) &&
[[m[0] objectAtIndex: 0] isEqual: c_ary[0]] &&
[[m[0] objectAtIndex: 1] isEqual: c_ary[0]] &&
[[m[0] objectAtIndex: 2] isEqual: c_ary[2]])
|
|
|
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
|
TEST(@"-[indexOfObject:]", [a[0] indexOfObject: c_ary[1]] == 1)
TEST(@"-[indexOfObjectIdenticalTo:]",
[a[1] indexOfObjectIdenticalTo: c_ary[1]] == 1)
TEST(@"-[objectsInRange:]",
[[a[0] objectsInRange: OFRangeMake(1, 2)] isEqual:
[arrayClass arrayWithObjects: c_ary[1], c_ary[2], nil]])
TEST(@"-[replaceObject:withObject:]",
R([m[0] replaceObject: c_ary[1] withObject: c_ary[0]]) &&
[[m[0] objectAtIndex: 0] isEqual: c_ary[0]] &&
[[m[0] objectAtIndex: 1] isEqual: c_ary[0]] &&
[[m[0] objectAtIndex: 2] isEqual: c_ary[2]])
|
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
|
m[1] = [[a[0] mutableCopy] autorelease];
TEST(@"-[removeObjectAtIndex:]", R([m[1] removeObjectAtIndex: 1]) &&
m[1].count == 2 && [[m[1] objectAtIndex: 1] isEqual: c_ary[2]])
m[1] = [[a[0] mutableCopy] autorelease];
TEST(@"-[removeObjectsInRange:]",
R([m[1] removeObjectsInRange: OFMakeRange(0, 2)]) &&
m[1].count == 1 && [[m[1] objectAtIndex: 0] isEqual: c_ary[2]])
m[1] = [[a[0] mutableCopy] autorelease];
[m[1] addObject: @"qux"];
[m[1] addObject: @"last"];
TEST(@"-[reverse]",
R([m[1] reverse]) && [m[1] isEqual: [arrayClass arrayWithObjects:
|
|
|
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
|
m[1] = [[a[0] mutableCopy] autorelease];
TEST(@"-[removeObjectAtIndex:]", R([m[1] removeObjectAtIndex: 1]) &&
m[1].count == 2 && [[m[1] objectAtIndex: 1] isEqual: c_ary[2]])
m[1] = [[a[0] mutableCopy] autorelease];
TEST(@"-[removeObjectsInRange:]",
R([m[1] removeObjectsInRange: OFRangeMake(0, 2)]) &&
m[1].count == 1 && [[m[1] objectAtIndex: 0] isEqual: c_ary[2]])
m[1] = [[a[0] mutableCopy] autorelease];
[m[1] addObject: @"qux"];
[m[1] addObject: @"last"];
TEST(@"-[reverse]",
R([m[1] reverse]) && [m[1] isEqual: [arrayClass arrayWithObjects:
|
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
|
@"z", @"Foo", @"Baz", @"Bar", @"0", nil]])
EXPECT_EXCEPTION(@"Detect out of range in -[objectAtIndex:]",
OFOutOfRangeException, [a[0] objectAtIndex: a[0].count])
EXPECT_EXCEPTION(@"Detect out of range in -[removeObjectsInRange:]",
OFOutOfRangeException, [m[0] removeObjectsInRange:
OFMakeRange(0, m[0].count + 1)])
TEST(@"-[componentsJoinedByString:]",
(a[1] = [arrayClass arrayWithObjects: @"", @"a", @"b", @"c",
nil]) &&
[[a[1] componentsJoinedByString: @" "] isEqual: @" a b c"] &&
(a[1] = [arrayClass arrayWithObject: @"foo"]) &&
[[a[1] componentsJoinedByString: @" "] isEqual: @"foo"])
|
|
|
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
|
@"z", @"Foo", @"Baz", @"Bar", @"0", nil]])
EXPECT_EXCEPTION(@"Detect out of range in -[objectAtIndex:]",
OFOutOfRangeException, [a[0] objectAtIndex: a[0].count])
EXPECT_EXCEPTION(@"Detect out of range in -[removeObjectsInRange:]",
OFOutOfRangeException, [m[0] removeObjectsInRange:
OFRangeMake(0, m[0].count + 1)])
TEST(@"-[componentsJoinedByString:]",
(a[1] = [arrayClass arrayWithObjects: @"", @"a", @"b", @"c",
nil]) &&
[[a[1] componentsJoinedByString: @" "] isEqual: @" a b c"] &&
(a[1] = [arrayClass arrayWithObject: @"foo"]) &&
[[a[1] componentsJoinedByString: @" "] isEqual: @"foo"])
|