test/map_tests.c

changeset 111
c8c59d7f4536
parent 103
08018864fb91
child 112
6384016df2a3
equal deleted inserted replaced
110:1cf71e56f01e 111:c8c59d7f4536
177 UcxMapIterator i = ucx_map_iterator(map); 177 UcxMapIterator i = ucx_map_iterator(map);
178 int check = 0; 178 int check = 0;
179 int hit = 0; 179 int hit = 0;
180 180
181 int* v; 181 int* v;
182 UCX_MAP_FOREACH(v, i) { 182 UCX_MAP_FOREACH(key, v, i) {
183 check += *v; 183 check += *v;
184 hit++; 184 hit++;
185 } 185 }
186 186
187 UCX_TEST_ASSERT(hit == 4, "test1: wrong number of hits"); 187 UCX_TEST_ASSERT(hit == 4, "test1: wrong number of hits");
272 "to test if the buffer extension works as designed") == 0, 272 "to test if the buffer extension works as designed") == 0,
273 "value error for key: simple"); 273 "value error for key: simple");
274 274
275 void *d; 275 void *d;
276 UcxMapIterator iter = ucx_map_iterator(map); 276 UcxMapIterator iter = ucx_map_iterator(map);
277 UCX_MAP_FOREACH(d, iter) { 277 UCX_MAP_FOREACH(key, d, iter) {
278 free(d); 278 free(d);
279 } 279 }
280 ucx_map_free(map); 280 ucx_map_free(map);
281 UCX_TEST_END 281 UCX_TEST_END
282 } 282 }
306 fclose(f); 306 fclose(f);
307 307
308 UCX_TEST_ASSERT(r == 0, "IO errors, test cannot be performed"); 308 UCX_TEST_ASSERT(r == 0, "IO errors, test cannot be performed");
309 UcxMapIterator iter = ucx_map_iterator(map); 309 UcxMapIterator iter = ucx_map_iterator(map);
310 const char *value; size_t n; 310 const char *value; size_t n;
311 UCX_MAP_FOREACH(value, iter) { 311 UCX_MAP_FOREACH(key, value, iter) {
312 n = strlen(value); 312 n = strlen(value);
313 UCX_TEST_ASSERT(strncmp((const char*) pool->data[iter.index], value, n), 313 UCX_TEST_ASSERT(strncmp((const char*) pool->data[iter.index], value, n),
314 "values of map does not match pooled values"); 314 "values of map does not match pooled values");
315 } 315 }
316 316

mercurial