diff -r 54a7ceb9151f -r 58b77eb51afd test/map_tests.c --- a/test/map_tests.c Tue May 19 17:01:28 2015 +0200 +++ b/test/map_tests.c Thu Oct 15 12:34:10 2015 +0200 @@ -163,6 +163,37 @@ ucx_map_free(map); } +UCX_TEST(test_ucx_map_clear) { + UcxMap *map = ucx_map_new(4); + + int value = 42; + + ucx_map_cstr_put(map, "Key0", &value); + ucx_map_cstr_put(map, "Key1", &value); + ucx_map_cstr_put(map, "Key2", &value); + ucx_map_cstr_put(map, "Key3", &value); + ucx_map_cstr_put(map, "Key4", &value); + ucx_map_cstr_put(map, "Key5", &value); + ucx_map_cstr_put(map, "Key6", &value); + UCX_TEST_BEGIN + + ucx_map_clear(map); + + UCX_TEST_ASSERT(map->count == 0, "map has not been cleared"); + UCX_TEST_ASSERT(map->size == 4, "map size has changed unexpectedly"); + + UCX_TEST_ASSERT(ucx_map_cstr_get(map, "Key0")==NULL, "element not removed"); + UCX_TEST_ASSERT(ucx_map_cstr_get(map, "Key1")==NULL, "element not removed"); + UCX_TEST_ASSERT(ucx_map_cstr_get(map, "Key2")==NULL, "element not removed"); + UCX_TEST_ASSERT(ucx_map_cstr_get(map, "Key3")==NULL, "element not removed"); + UCX_TEST_ASSERT(ucx_map_cstr_get(map, "Key4")==NULL, "element not removed"); + UCX_TEST_ASSERT(ucx_map_cstr_get(map, "Key5")==NULL, "element not removed"); + UCX_TEST_ASSERT(ucx_map_cstr_get(map, "Key6")==NULL, "element not removed"); + + UCX_TEST_END + ucx_map_free(map); +} + UCX_TEST_SUBROUTINE(test_ucx_map_itersrt, UcxMap *map) { int v1 = 10; int v2 = 15;