ObjFW  Diff

Differences From Artifact [964609bde3]:

To Artifact [8332694435]:


81
82
83
84
85
86
87
88

89
90
91
92
93
94
95
96
97
98
99


100
101
102
103
104
105
106
107
81
82
83
84
85
86
87

88
89
90
91
92
93
94
95
96
97


98
99

100
101
102
103
104
105
106







-
+









-
-
+
+
-







	    [[a[1] objectAtIndex: 1] isEqual: c_ary[1]] &&
	    [[a[1] objectAtIndex: 2] isEqual: c_ary[2]])

	TEST(@"-[containsObject:]",
	    [a[0] containsObject: c_ary[1]] == YES &&
	    [a[0] containsObject: @"nonexistant"] == NO)

	TEST(@"-[containsObject:]",
	TEST(@"-[containsObjectIdenticalTo:]",
	    [a[0] containsObjectIdenticalTo: c_ary[1]] == YES &&
	    [a[0] containsObjectIdenticalTo:
	    [OFString stringWithString: c_ary[1]]] == NO)

	TEST(@"-[indexOfObject:]", [a[0] indexOfObject: c_ary[1]] == 1)

	TEST(@"-[indexOfObjectIdenticalTo:]",
	    [a[1] indexOfObjectIdenticalTo: c_ary[1]] == 1)

	TEST(@"-[objectsFromIndex:toIndex",
	    [[a[0] objectsFromIndex: 1
	TEST(@"-[objectsInRange:]",
	    [[a[0] objectsInRange: of_range(1, 2)] isEqual:
			    toIndex: 3] isEqual:
	    ([OFArray 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]] &&
133
134
135
136
137
138
139
140
141


142
143
144
145
146
147

148
149
150
151
152
153
154
132
133
134
135
136
137
138


139
140
141
142
143
144
145

146
147
148
149
150
151
152
153







-
-
+
+





-
+







	    [m[0] count] == 1 && [[m[0] objectAtIndex: 0] isEqual: c_ary[0]])

	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(@"-[removeNObjects:atIndex:]", R([m[1] removeNObjects: 2
							   atIndex: 0]) &&
	TEST(@"-[removeObjectsInRange:]",
	    R([m[1] removeObjectsInRange: of_range(0, 2)]) &&
	    [m[1] count] == 1 && [[m[1] 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:]",
	EXPECT_EXCEPTION(@"Detect out of range in -[removeNObjects:]",
	    OFOutOfRangeException, [m[0] removeNObjects: [m[0] count] + 1])

	TEST(@"-[componentsJoinedByString:]",
	    (a[1] = [OFArray arrayWithObjects: @"foo", @"bar", @"baz", nil]) &&
	    [[a[1] componentsJoinedByString: @" "] isEqual: @"foo bar baz"] &&
	    (a[1] = [OFArray arrayWithObject: @"foo"]) &&
	    [[a[1] componentsJoinedByString: @" "] isEqual: @"foo"])
200
201
202
203
204
205
206

207
208
209





210
211
212

213
214
215
216
217
218
219
199
200
201
202
203
204
205
206
207


208
209
210
211
212
213
214

215
216
217
218
219
220
221
222







+

-
-
+
+
+
+
+


-
+







			withObject: c_ary[0]];
	[m[0] replaceObjectAtIndex: 1
			withObject: c_ary[1]];
	[m[0] replaceObjectAtIndex: 2
			withObject: c_ary[2]];

	ok = NO;
	i = 0;
	@try {
		for (OFString *s in m[0])
			[m[0] addObject: @""];
		for (OFString *s in m[0]) {
			if (i == 0)
				[m[0] addObject: @""];
			i++;
		}
	} @catch (OFEnumerationMutationException *e) {
		ok = YES;
		[e dealloc];
		[e release];
	}

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

	[m[0] removeNObjects: 1];
#endif

242
243
244
245
246
247
248




249



250
251
252
253
254
255
256
245
246
247
248
249
250
251
252
253
254
255

256
257
258
259
260
261
262
263
264
265







+
+
+
+
-
+
+
+







		@try {
			[a2 enumerateObjectsUsingBlock:
			    ^ (id obj, size_t idx, BOOL *stop) {
				[a2 removeObjectAtIndex: idx];
			}];
		} @catch (OFEnumerationMutationException *e) {
			ok = YES;
			[e release];
		} @catch (OFOutOfRangeException *e) {
			/*
			 * Out of bounds access due to enumeration not being
			[e dealloc];
			 * detected.
			 */
			[e release];
		}

		TEST(@"Detection of mutation during enumeration using blocks",
		    ok)
	}

	TEST(@"-[replaceObjectsUsingBlock:]",