test/map_tests.c

changeset 34
0dcd2ca2a223
parent 33
9c219a62070d
child 40
583718dd4cf3
     1.1 --- a/test/map_tests.c	Thu May 31 12:51:22 2012 +0200
     1.2 +++ b/test/map_tests.c	Fri Jun 01 12:35:30 2012 +0200
     1.3 @@ -68,9 +68,31 @@
     1.4  }
     1.5  
     1.6  UCX_TEST_IMPLEMENT(test_ucx_map_get) {
     1.7 +    UcxMap *map = ucx_map_new(4);
     1.8 +
     1.9 +    int td[5];
    1.10 +    td[0] = 10; td[1] = 42; td[2] = 70; td[3] = 11200; td[4] = 80000;
    1.11 +
    1.12 +    ucx_map_cstr_put(map, "Key2", &td[2]); /* 0 */
    1.13 +    ucx_map_cstr_put(map, "Key0", &td[0]); /* 0 */
    1.14 +    ucx_map_cstr_put(map, "Key1", &td[1]); /* 3 */
    1.15 +    ucx_map_cstr_put(map, "KeY3", &td[3]); /* 2 */
    1.16 +    ucx_map_cstr_put(map, "KEY4", &td[4]); /* 0 */
    1.17      UCX_TEST_BEGIN
    1.18 -    UCX_TEST_ASSERT(0, "not implemented");
    1.19 +
    1.20 +    td[0] = *((int*)ucx_map_cstr_get(map, "Key0"));
    1.21 +    td[1] = *((int*)ucx_map_cstr_get(map, "Key1"));
    1.22 +    td[2] = *((int*)ucx_map_cstr_get(map, "Key2"));
    1.23 +    td[3] = *((int*)ucx_map_cstr_get(map, "KeY3"));
    1.24 +    td[4] = *((int*)ucx_map_cstr_get(map, "KEY4"));
    1.25 +    UCX_TEST_ASSERT(td[0] == 10, "failed key 0")
    1.26 +    UCX_TEST_ASSERT(td[1] == 42, "failed key 1")
    1.27 +    UCX_TEST_ASSERT(td[2] == 70, "failed key 2")
    1.28 +    UCX_TEST_ASSERT(td[3] == 11200, "failed key 3")
    1.29 +    UCX_TEST_ASSERT(td[4] == 80000, "failed key 4")
    1.30 +
    1.31      UCX_TEST_END
    1.32 +    ucx_map_free(map);
    1.33  }
    1.34  
    1.35  UCX_TEST_SUBROUTINE(test_ucx_map_itersrt, mapptr) {

mercurial