58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
|
TEST(@"-[mutableCopy]",
(mutableSet = [[set1 mutableCopy] autorelease]));
TEST(@"-[addObject:]",
R([mutableSet addObject: @"baz"]) && [mutableSet isEqual: set2] &&
R([mutableSet addObject: @"y"]) && [mutableSet isEqual:
([OFSet setWithObjects: @"foo", @"bar", @"baz", @"x", @"y", nil])])
TEST(@"-[removeObject:]",
R([mutableSet removeObject: @"y"]) && [mutableSet isEqual: set1])
TEST(@"-[isSubsetOfSet:]",
R([mutableSet removeObject: @"foo"]) &&
[mutableSet isSubsetOfSet: set1] &&
![set1 isSubsetOfSet: mutableSet]);
TEST(@"-[intersectsSet:]",
[(set2 = [OFSet setWithObjects: @"x", nil]) intersectsSet: set1] &&
[set1 intersectsSet: set2] &&
![([OFSet setWithObjects: @"1", nil]) intersectsSet: set1]);
TEST(@"-[minusSet:]",
R([mutableSet minusSet: ([OFSet setWithObjects: @"x", nil])]) &&
[mutableSet isEqual: ([OFSet setWithObjects: @"baz", @"bar", nil])])
TEST(@"-[intersectSet:]",
R([mutableSet intersectSet: ([OFSet setWithObjects: @"baz",
nil])]) && [mutableSet isEqual: ([OFSet setWithObjects: @"baz",
nil])])
TEST(@"-[unionSet:]",
R([mutableSet unionSet: ([OFSet setWithObjects: @"x", @"bar",
nil])]) && [mutableSet isEqual: ([OFSet setWithObjects: @"baz",
@"bar", @"x", nil])])
#ifdef OF_HAVE_FAST_ENUMERATION
ok = true;
i = 0;
for (OFString *s in set1) {
switch (i) {
|
|
|
|
|
|
|
|
|
|
|
|
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
|
TEST(@"-[mutableCopy]",
(mutableSet = [[set1 mutableCopy] autorelease]));
TEST(@"-[addObject:]",
R([mutableSet addObject: @"baz"]) && [mutableSet isEqual: set2] &&
R([mutableSet addObject: @"y"]) && [mutableSet isEqual:
[OFSet setWithObjects: @"foo", @"bar", @"baz", @"x", @"y", nil]])
TEST(@"-[removeObject:]",
R([mutableSet removeObject: @"y"]) && [mutableSet isEqual: set1])
TEST(@"-[isSubsetOfSet:]",
R([mutableSet removeObject: @"foo"]) &&
[mutableSet isSubsetOfSet: set1] &&
![set1 isSubsetOfSet: mutableSet]);
TEST(@"-[intersectsSet:]",
[(set2 = [OFSet setWithObjects: @"x", nil]) intersectsSet: set1] &&
[set1 intersectsSet: set2] &&
![[OFSet setWithObjects: @"1", nil] intersectsSet: set1]);
TEST(@"-[minusSet:]",
R([mutableSet minusSet: [OFSet setWithObjects: @"x", nil]]) &&
[mutableSet isEqual: [OFSet setWithObjects: @"baz", @"bar", nil]])
TEST(@"-[intersectSet:]",
R([mutableSet intersectSet: [OFSet setWithObjects: @"baz",
nil]]) && [mutableSet isEqual: [OFSet setWithObjects: @"baz",
nil]])
TEST(@"-[unionSet:]",
R([mutableSet unionSet: [OFSet setWithObjects: @"x", @"bar",
nil]]) && [mutableSet isEqual: [OFSet setWithObjects: @"baz",
@"bar", @"x", nil]])
#ifdef OF_HAVE_FAST_ENUMERATION
ok = true;
i = 0;
for (OFString *s in set1) {
switch (i) {
|