ObjFW  Diff

Differences From Artifact [ae430dfeb5]:

To Artifact [bc85efc808]:


28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45

@implementation TestsAppDelegate (OFSetTests)
- (void)setTests
{
	OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init];
	OFSet *set1, *set2;
	OFMutableSet *mutableSet;
#ifdef OF_HAVE_FAST_ENUMERATION
	bool ok;
	size_t i;
#endif

	TEST(@"+[setWithArray:]",
	    (set1 = [OFSet setWithArray: [OFArray arrayWithObjects: @"foo",
	    @"bar", @"baz", @"foo", @"x", nil]]))

	TEST(@"+[setWithObjects:]",
	    (set2 = [OFSet setWithObjects: @"foo", @"bar", @"baz", @"bar", @"x",







<


<







28
29
30
31
32
33
34

35
36

37
38
39
40
41
42
43

@implementation TestsAppDelegate (OFSetTests)
- (void)setTests
{
	OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init];
	OFSet *set1, *set2;
	OFMutableSet *mutableSet;

	bool ok;
	size_t i;


	TEST(@"+[setWithArray:]",
	    (set1 = [OFSet setWithArray: [OFArray arrayWithObjects: @"foo",
	    @"bar", @"baz", @"foo", @"x", nil]]))

	TEST(@"+[setWithObjects:]",
	    (set2 = [OFSet setWithObjects: @"foo", @"bar", @"baz", @"bar", @"x",
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
	    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) {
		case 0:
			if (![s isEqual: @"x"])







<







85
86
87
88
89
90
91

92
93
94
95
96
97
98
	    nil]])

	TEST(@"-[unionSet:]",
	    R([mutableSet unionSet: [OFSet setWithObjects: @"x", @"bar",
	    nil]]) && [mutableSet isEqual: [OFSet setWithObjects: @"baz",
	    @"bar", @"x", nil]])


	ok = true;
	i = 0;

	for (OFString *s in set1) {
		switch (i) {
		case 0:
			if (![s isEqual: @"x"])
128
129
130
131
132
133
134
135
136
137
138
139
		for (OFString *s in mutableSet)
			[mutableSet removeObject: s];
	} @catch (OFEnumerationMutationException *e) {
		ok = true;
	}

	TEST(@"Detection of mutation during Fast Enumeration", ok);
#endif

	[pool drain];
}
@end







<




125
126
127
128
129
130
131

132
133
134
135
		for (OFString *s in mutableSet)
			[mutableSet removeObject: s];
	} @catch (OFEnumerationMutationException *e) {
		ok = true;
	}

	TEST(@"Detection of mutation during Fast Enumeration", ok);


	[pool drain];
}
@end