1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29 #include "test_map_generics.h"
30 #include "cx/hash_map.h"
31
32 CxMap *test_map_generics_step_1(CxAllocator
const * allocator) {
33 CxMap *map = cxHashMapCreate(allocator,
sizeof(cxstring),
0);
34
35 cxMapPut(map,
"test",
"test");
36 cxMapPut(map, cx_mutstr(
"foo"),
"bar");
37 cxMapPut(map, cx_str(
"hallo"),
"welt");
38
39 return map;
40 }
41
42 void test_map_generics_step_2(CxMap *map) {
43
44 cxMapRemove(map, cx_str(
"test"));
45 char const* hallo =
"hallo";
46 cxMapDetach(map, hallo);
47 cxMapPut(map, cx_hash_key_str(
"key"),
"value");
48 }
49
50 void test_map_generics_step_3(CxMap *map) {
51 void *r;
52 r = cxMapRemoveAndGet(map,
"key");
53 r = cxMapRemoveAndGet(map, cx_str(
"foo"));
54 if (r !=
NULL) map->size =
47;
55 }
56