ObjFW  Check-in [ea3c419495]

Overview
Comment:Move -[replaceObjectsUsingBlock:] test to the right place.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: ea3c4194952257c836d9d135a54674850f6e067cd50cd79f087abb1ea54a593b
User & Date: js on 2010-09-08 10:02:13
Other Links: manifest | tags
Context
2010-09-08
11:13
Check for all atomic ops implementations available. check-in: 56006b4b49 user: js tags: trunk
10:02
Move -[replaceObjectsUsingBlock:] test to the right place. check-in: ea3c419495 user: js tags: trunk
09:58
Add some #ifdefs to make OFBlocks.m compile with the Apple runtime. check-in: 0c55736c5d user: js tags: trunk
Changes

Modified tests/OFDictionaryTests.m from [9041d899a3] to [e289cdd042].

89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
89
90
91
92
93
94
95












96
97
98
99
100
101
102







-
-
-
-
-
-
-
-
-
-
-
-







		ok = YES;
		[e dealloc];
	}

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

	[dict removeObjectForKey: @""];

	TEST(@"-[replaceObjectsUsingBlock:]",
	    R([dict replaceObjectsUsingBlock:
	    ^ id (id key, id obj, BOOL *stop) {
		if ([key isEqual: keys[0]])
			return @"value_1";
		if ([key isEqual: keys[1]])
			return @"value_2";

		return nil;
	    }]) && [[dict objectForKey: keys[0]] isEqual: @"value_1"] &&
	    [[dict objectForKey: keys[1]] isEqual: @"value_2"])
#endif

#ifdef OF_HAVE_BLOCKS
	{
		__block size_t i = 0;
		__block BOOL ok = YES;

136
137
138
139
140
141
142












143
144
145
146
147
148
149
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149







+
+
+
+
+
+
+
+
+
+
+
+







		}

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

		[dict removeObjectForKey: @""];
	}

	TEST(@"-[replaceObjectsUsingBlock:]",
	    R([dict replaceObjectsUsingBlock:
	    ^ id (id key, id obj, BOOL *stop) {
		if ([key isEqual: keys[0]])
			return @"value_1";
		if ([key isEqual: keys[1]])
			return @"value_2";

		return nil;
	    }]) && [[dict objectForKey: keys[0]] isEqual: @"value_1"] &&
	    [[dict objectForKey: keys[1]] isEqual: @"value_2"])
#endif

	TEST(@"-[count]", [dict count] == 2)

	TEST(@"+[dictionaryWithKeysAndObjects:]",
	    (dict = [OFDictionary dictionaryWithKeysAndObjects: @"foo", @"bar",
								@"baz", @"qux",