olaf@20: /* olaf@20: * olaf@20: */ olaf@20: olaf@20: #include olaf@20: #include olaf@20: #include olaf@20: olaf@20: #include "map_tests.h" olaf@20: olaf@20: int map_tests() { olaf@20: printf(" Test ucx_map_new\n"); olaf@20: UcxMap *map = ucx_map_new(16); olaf@20: if(map == NULL) { olaf@20: return -1; olaf@20: } olaf@20: olaf@20: printf(" Test ucx_map_put\n"); olaf@20: char *txt = "text/plain"; olaf@20: char *xml = "text/xml"; olaf@20: ucx_map_cstr_put(map, "txt", txt); olaf@20: ucx_map_cstr_put(map, "xml", xml); olaf@20: olaf@20: printf(" Test ucx_map_get\n"); olaf@20: if(ucx_map_cstr_get(map, "txt") != txt) { olaf@20: fprintf(stderr, "ucx_map_get failed\n"); olaf@20: return -1; olaf@20: } olaf@20: char xmlkey[4]; olaf@20: xmlkey[0] = 'x'; olaf@20: xmlkey[1] = 'm'; olaf@20: xmlkey[2] = 'l'; olaf@20: xmlkey[3] = 0; olaf@20: if(ucx_map_cstr_get(map, xmlkey) != xml) { olaf@20: fprintf(stderr, "ucx_map_get failed\n"); olaf@20: return -1; olaf@20: } olaf@20: if(ucx_map_cstr_get(map, "nokey") != NULL) { olaf@20: fprintf(stderr, "ucx_map_get failed\n"); olaf@20: return -1; olaf@20: } olaf@20: olaf@20: return 0; olaf@20: }