Sat, 14 Jan 2012 13:07:18 +0100
merge
/* * */ #include <stdio.h> #include <stdlib.h> #include <string.h> #include "map_tests.h" int map_tests() { printf(" Test ucx_map_new\n"); UcxMap *map = ucx_map_new(16); if(map == NULL) { return -1; } printf(" Test ucx_map_put\n"); char *txt = "text/plain"; char *xml = "text/xml"; ucx_map_cstr_put(map, "txt", txt); ucx_map_cstr_put(map, "xml", xml); printf(" Test ucx_map_get\n"); if(ucx_map_cstr_get(map, "txt") != txt) { fprintf(stderr, "ucx_map_get failed\n"); return -1; } char xmlkey[4]; xmlkey[0] = 'x'; xmlkey[1] = 'm'; xmlkey[2] = 'l'; xmlkey[3] = 0; if(ucx_map_cstr_get(map, xmlkey) != xml) { fprintf(stderr, "ucx_map_get failed\n"); return -1; } if(ucx_map_cstr_get(map, "nokey") != NULL) { fprintf(stderr, "ucx_map_get failed\n"); return -1; } return 0; }