| 244 CX_TEST_DO { |
244 CX_TEST_DO { |
| 245 // create the map |
245 // create the map |
| 246 CxMap *map = cxHashMapCreate(allocator, sizeof(cxstring), 8); |
246 CxMap *map = cxHashMapCreate(allocator, sizeof(cxstring), 8); |
| 247 |
247 |
| 248 // define some strings |
248 // define some strings |
| 249 cxstring s1 = CX_STR("this"); |
249 cxstring s1 = cx_str("this"); |
| 250 cxstring s2 = CX_STR("is"); |
250 cxstring s2 = cx_str("is"); |
| 251 cxstring s3 = CX_STR("a"); |
251 cxstring s3 = cx_str("a"); |
| 252 cxstring s4 = CX_STR("test"); |
252 cxstring s4 = cx_str("test"); |
| 253 cxstring s5 = CX_STR("setup"); |
253 cxstring s5 = cx_str("setup"); |
| 254 |
254 |
| 255 // put them into the map |
255 // put them into the map |
| 256 cxMapPut(map, "s1", &s1); |
256 cxMapPut(map, "s1", &s1); |
| 257 cxMapPut(map, "s2", &s2); |
257 cxMapPut(map, "s2", &s2); |
| 258 cxMapPut(map, "s3", &s3); |
258 cxMapPut(map, "s3", &s3); |
| 290 } |
290 } |
| 291 |
291 |
| 292 CX_TEST(test_hash_map_integer_keys) { |
292 CX_TEST(test_hash_map_integer_keys) { |
| 293 CxMap *map = cxHashMapCreateSimple(sizeof(cxstring)); |
293 CxMap *map = cxHashMapCreateSimple(sizeof(cxstring)); |
| 294 CX_TEST_DO { |
294 CX_TEST_DO { |
| 295 cxstring s1 = CX_STR("hello"); |
295 cxstring s1 = cx_str("hello"); |
| 296 cxstring s2 = CX_STR("world"); |
296 cxstring s2 = cx_str("world"); |
| 297 |
297 |
| 298 cxMapPut(map, UINT32_C(70875), &s1); |
298 cxMapPut(map, UINT32_C(70875), &s1); |
| 299 cxMapPut(map, UINT64_C(5785133750), &s2); |
299 cxMapPut(map, UINT64_C(5785133750), &s2); |
| 300 |
300 |
| 301 CX_TEST_ASSERT(cx_strcmp_p(&s1, cxMapGet(map, UINT32_C(70875))) == 0); |
301 CX_TEST_ASSERT(cx_strcmp_p(&s1, cxMapGet(map, UINT32_C(70875))) == 0); |