57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
|
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
|
+
+
+
+
+
+
+
+
+
|
[[a[2] objectAtIndex: 0] isEqual: c_ary[0]] &&
[[a[2] objectAtIndex: 1] isEqual: c_ary[1]] &&
[[a[2] objectAtIndex: 2] isEqual: c_ary[2]])
TEST(@"-[removeNObjects:]", [a[0] removeNObjects: 2] &&
[a[0] count] == 1 && [[a[0] objectAtIndex: 0] isEqual: c_ary[0]])
a[1] = [[a[1] mutableCopy] autorelease];
TEST(@"-[removeObjectAtIndex:]", [a[1] removeObjectAtIndex: 1] &&
[a[1] count] == 2 && [[a[1] objectAtIndex: 1] isEqual: c_ary[2]])
a[2] = [[a[2] mutableCopy] autorelease];
TEST(@"-[removeNObjects:atIndex:]", [a[2] removeNObjects: 2
atIndex: 0] &&
[a[2] count] == 1 && [[a[2] objectAtIndex: 0] isEqual: c_ary[2]])
EXPECT_EXCEPTION(@"Detect out of range in -[objectAtIndex:]",
OFOutOfRangeException, [a[0] objectAtIndex: [a[0] count]])
EXPECT_EXCEPTION(@"Detect out of range in -[removeNItems:]",
OFOutOfRangeException, [a[0] removeNObjects: [a[0] count] + 1])
[pool release];
}
|