26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
puts("NOT CAUGHT!"); \
return 1; \
} @catch (exception *e) { \
puts("CAUGHT! Error string was:"); \
puts([[e string] cString]); \
puts("Resuming..."); \
}
int
main()
{
OFArray *a = [OFArray arrayWithObjects: @"Foo", @"Bar", @"Baz", nil];
OFArray *b = [OFMutableArray array];
[b add: @"Foo"];
[b add: @"Bar"];
[b add: @"Baz"];
assert([a count] == 3);
assert([b count] == 3);
assert([a isEqual: b]);
[b removeNObjects: 1];
[b add: @"Baz"];
assert([a isEqual: b]);
[b removeNObjects: 1];
[b add: @"Qux"];
|
>
>
>
>
>
>
>
>
>
>
|
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
puts("NOT CAUGHT!"); \
return 1; \
} @catch (exception *e) { \
puts("CAUGHT! Error string was:"); \
puts([[e string] cString]); \
puts("Resuming..."); \
}
id c_array[] = {
@"Foo",
@"Bar",
@"Baz",
nil
};
int
main()
{
OFArray *a = [OFArray arrayWithObjects: @"Foo", @"Bar", @"Baz", nil];
OFArray *b = [OFMutableArray array];
OFArray *c = [OFArray arrayWithCArray: c_array];
[b add: @"Foo"];
[b add: @"Bar"];
[b add: @"Baz"];
assert([a count] == 3);
assert([b count] == 3);
assert([c count] == 3);
assert([a isEqual: b]);
assert([a isEqual: c]);
[b removeNObjects: 1];
[b add: @"Baz"];
assert([a isEqual: b]);
[b removeNObjects: 1];
[b add: @"Qux"];
|