test/map_tests.c

changeset 40
583718dd4cf3
parent 34
0dcd2ca2a223
child 41
7f90a03e186e
     1.1 --- a/test/map_tests.c	Tue Oct 02 13:43:17 2012 +0200
     1.2 +++ b/test/map_tests.c	Thu Oct 04 11:37:23 2012 +0200
     1.3 @@ -7,8 +7,8 @@
     1.4  UCX_TEST_IMPLEMENT(test_ucx_map_new) {
     1.5      UcxMap *map = ucx_map_new(16);
     1.6      UCX_TEST_BEGIN
     1.7 -    UCX_TEST_ASSERT(map->size == 16, "wrong size")
     1.8 -    UCX_TEST_ASSERT(map->map != NULL, "failed")
     1.9 +    UCX_TEST_ASSERT(map->size == 16, "wrong size");
    1.10 +    UCX_TEST_ASSERT(map->map != NULL, "failed");
    1.11      
    1.12      UCX_TEST_END
    1.13      ucx_map_free(map);
    1.14 @@ -17,9 +17,9 @@
    1.15  UCX_TEST_IMPLEMENT(test_ucx_key) {
    1.16      UcxKey key = ucx_key("This is a text.", 15);
    1.17      UCX_TEST_BEGIN
    1.18 -    UCX_TEST_ASSERT(strncmp(key.data, "This is a text.", 15) == 0, "failed")
    1.19 -    UCX_TEST_ASSERT(key.len == 15, "failed")
    1.20 -    UCX_TEST_ASSERT(key.hash == 1261186027, "hash failed")
    1.21 +    UCX_TEST_ASSERT(strncmp(key.data, "This is a text.", 15) == 0, "failed");
    1.22 +    UCX_TEST_ASSERT(key.len == 15, "failed");
    1.23 +    UCX_TEST_ASSERT(key.hash == 1261186027, "hash failed");
    1.24      
    1.25      UCX_TEST_END
    1.26  }
    1.27 @@ -38,30 +38,30 @@
    1.28      ucx_map_cstr_put(map, "KeY3", &td[3]); /* 2 */
    1.29      ucx_map_cstr_put(map, "KEY4", &td[4]); /* 0 */
    1.30      
    1.31 -    UCX_TEST_ASSERT(*((int*)map->map[0]->data) == td[0], "failed Key0")
    1.32 -    UCX_TEST_ASSERT(map->map[0]->next != NULL, "no list at slot 0")
    1.33 -    UCX_TEST_ASSERT(*((int*)map->map[0]->next->data) == td[2], "failed Key2")
    1.34 -    UCX_TEST_ASSERT(map->map[0]->next->next != NULL, "list corrupt at slot 0")
    1.35 +    UCX_TEST_ASSERT(*((int*)map->map[0]->data) == td[0], "failed Key0");
    1.36 +    UCX_TEST_ASSERT(map->map[0]->next != NULL, "no list at slot 0");
    1.37 +    UCX_TEST_ASSERT(*((int*)map->map[0]->next->data) == td[2], "failed Key2");
    1.38 +    UCX_TEST_ASSERT(map->map[0]->next->next != NULL, "list corrupt at slot 0");
    1.39      UCX_TEST_ASSERT(*((int*)map->map[0]->next->next->data) == td[4],
    1.40              "failed Key4")
    1.41      UCX_TEST_ASSERT(map->map[0]->next->next->next == NULL,
    1.42              "slot 0 not terminated")
    1.43  
    1.44 -    UCX_TEST_ASSERT(map->map[1] == NULL, "slot 1 not terminated")
    1.45 +    UCX_TEST_ASSERT(map->map[1] == NULL, "slot 1 not terminated");
    1.46  
    1.47 -    UCX_TEST_ASSERT(*((int*)map->map[2]->data) == td[3], "failed KeY3")
    1.48 -    UCX_TEST_ASSERT(map->map[2]->next == NULL, "slot 2 not terminated")
    1.49 +    UCX_TEST_ASSERT(*((int*)map->map[2]->data) == td[3], "failed KeY3");
    1.50 +    UCX_TEST_ASSERT(map->map[2]->next == NULL, "slot 2 not terminated");
    1.51  
    1.52 -    UCX_TEST_ASSERT(*((int*)map->map[3]->data) == td[1], "failed Key1")
    1.53 +    UCX_TEST_ASSERT(*((int*)map->map[3]->data) == td[1], "failed Key1");
    1.54  
    1.55      ucx_map_cstr_put(map, "Key0", &td[3]); /* 0 */
    1.56      
    1.57 -    UCX_TEST_ASSERT(*((int*)map->map[0]->data) == td[3], "overwrite failed")
    1.58 +    UCX_TEST_ASSERT(*((int*)map->map[0]->data) == td[3], "overwrite failed");
    1.59      UCX_TEST_ASSERT(*((int*)map->map[0]->next->data) == td[2],
    1.60              "overwrite failed")
    1.61      UCX_TEST_ASSERT(*((int*)map->map[0]->next->next->data) == td[4], 
    1.62              "overwrite failed")
    1.63 -    UCX_TEST_ASSERT(map->map[0]->next->next->next == NULL, "overwrite failed")
    1.64 +    UCX_TEST_ASSERT(map->map[0]->next->next->next == NULL, "overwrite failed");
    1.65      
    1.66      UCX_TEST_END
    1.67      ucx_map_free(map);
    1.68 @@ -85,11 +85,11 @@
    1.69      td[2] = *((int*)ucx_map_cstr_get(map, "Key2"));
    1.70      td[3] = *((int*)ucx_map_cstr_get(map, "KeY3"));
    1.71      td[4] = *((int*)ucx_map_cstr_get(map, "KEY4"));
    1.72 -    UCX_TEST_ASSERT(td[0] == 10, "failed key 0")
    1.73 -    UCX_TEST_ASSERT(td[1] == 42, "failed key 1")
    1.74 -    UCX_TEST_ASSERT(td[2] == 70, "failed key 2")
    1.75 -    UCX_TEST_ASSERT(td[3] == 11200, "failed key 3")
    1.76 -    UCX_TEST_ASSERT(td[4] == 80000, "failed key 4")
    1.77 +    UCX_TEST_ASSERT(td[0] == 10, "failed key 0");
    1.78 +    UCX_TEST_ASSERT(td[1] == 42, "failed key 1");
    1.79 +    UCX_TEST_ASSERT(td[2] == 70, "failed key 2");
    1.80 +    UCX_TEST_ASSERT(td[3] == 11200, "failed key 3");
    1.81 +    UCX_TEST_ASSERT(td[4] == 80000, "failed key 4");
    1.82  
    1.83      UCX_TEST_END
    1.84      ucx_map_free(map);

mercurial