--- a/test/map_tests.c Thu Oct 11 16:29:30 2012 +0200 +++ b/test/map_tests.c Fri Oct 12 10:54:55 2012 +0200 @@ -17,7 +17,8 @@ UCX_TEST_IMPLEMENT(test_ucx_key) { UcxKey key = ucx_key("This is a text.", 15); UCX_TEST_BEGIN - UCX_TEST_ASSERT(strncmp(key.data, "This is a text.", 15) == 0, "failed"); + UCX_TEST_ASSERT(strncmp((const char*)key.data, "This is a text.", 15) == 0, + "failed"); UCX_TEST_ASSERT(key.len == 15, "failed"); UCX_TEST_ASSERT(key.hash == 1261186027, "hash failed"); @@ -179,9 +180,9 @@ } void* test_ucx_map_store_load_encdec(void *value, void *data, size_t *size) { - char *string = (char*) value; + const char *string = (const char*) value; size_t n = strlen(string); - char *encoded = malloc(n+1); + char *encoded = (char*) malloc(n+1); for (int i = 0 ; i < n ; i++) { encoded[i] = string[n-1-i]; } @@ -218,29 +219,29 @@ test_ucx_map_store_load_encdec, NULL); fclose(f); - char *value; + const char *value; UCX_TEST_ASSERT(r == 0, "IO errors, test cannot be performed"); - value = ucx_map_cstr_get(map, "test"); + value = (const char *) ucx_map_cstr_get(map, "test"); UCX_TEST_ASSERT(value != NULL, "value not found for key: test"); UCX_TEST_ASSERT(strcmp(value, "test") == 0, "value error for key: test"); - value = ucx_map_cstr_get(map, "key"); + value = (const char *) ucx_map_cstr_get(map, "key"); UCX_TEST_ASSERT(value != NULL, "value not found for key: key"); UCX_TEST_ASSERT(strcmp(value, "value") == 0, "value error for key: key"); - value = ucx_map_cstr_get(map, "other.very.long.key"); + value = (const char *) ucx_map_cstr_get(map, "other.very.long.key"); UCX_TEST_ASSERT(value != NULL, "value not found for key: other.very.long.key"); UCX_TEST_ASSERT(strcmp(value, "value") == 0, "value error for key: other.very.long.key"); - value = ucx_map_cstr_get(map, "testkey"); + value = (const char *) ucx_map_cstr_get(map, "testkey"); UCX_TEST_ASSERT(value != NULL, "value not found for key: testkey"); UCX_TEST_ASSERT(strcmp(value, "testvalue") == 0, "value error for key: testkey"); - value = ucx_map_cstr_get(map, "simple"); + value = (const char *) ucx_map_cstr_get(map, "simple"); UCX_TEST_ASSERT(value != NULL, "value not found for key: simple"); UCX_TEST_ASSERT(strcmp(value, "not a key but an extremely long value " "to test if the buffer extension works as designed") == 0, @@ -281,10 +282,10 @@ UCX_TEST_ASSERT(r == 0, "IO errors, test cannot be performed"); UcxMapIterator iter = ucx_map_iterator(map); - char *value; size_t n; + const char *value; size_t n; UCX_MAP_FOREACH(value, iter) { n = strlen(value); - UCX_TEST_ASSERT(strncmp(pool->data[iter.index], value, n), + UCX_TEST_ASSERT(strncmp((const char*) pool->data[iter.index], value, n), "values of map does not match pooled values"); } @@ -302,9 +303,9 @@ UcxMap *clone = ucx_map_clone(map, NULL, NULL); - char *v1 = ucx_map_cstr_get(map, "key1"); - char *v2 = ucx_map_cstr_get(map, "key2"); - char *v3 = ucx_map_cstr_get(map, "key3"); + const char *v1 = (const char *) ucx_map_cstr_get(map, "key1"); + const char *v2 = (const char *) ucx_map_cstr_get(map, "key2"); + const char *v3 = (const char *) ucx_map_cstr_get(map, "key3"); UCX_TEST_BEGIN @@ -312,9 +313,9 @@ UCX_TEST_ASSERT(v2 != NULL, "failed key 2"); UCX_TEST_ASSERT(v3 != NULL, "failed key 3"); - char *c1 = ucx_map_cstr_get(clone, "key1"); - char *c2 = ucx_map_cstr_get(clone, "key2"); - char *c3 = ucx_map_cstr_get(clone, "key3"); + const char *c1 = (const char *) ucx_map_cstr_get(clone, "key1"); + const char *c2 = (const char *) ucx_map_cstr_get(clone, "key2"); + const char *c3 = (const char *) ucx_map_cstr_get(clone, "key3"); UCX_TEST_ASSERT(c1 != NULL, "failed key 1 (clone)"); UCX_TEST_ASSERT(c2 != NULL, "failed key 2 (clone)"); @@ -350,7 +351,7 @@ UCX_TEST_ASSERT(map->size == 25, "new capacity shall be 2.5 * count"); UCX_TEST_ASSERT(map->count == 10, "new map element count incorrect"); for (int i = 0 ; i < 10 ; i++) { - char *value = ucx_map_cstr_get(map, keys[i]); + const char *value = (const char *) ucx_map_cstr_get(map, keys[i]); UCX_TEST_ASSERT(value != NULL, "new map is missing old keys"); UCX_TEST_ASSERT(strncmp(value, values[i], 6) == 0, "new map contains incorrect values");