test/map_tests.c

Fri, 05 Oct 2012 11:55:36 +0200

author
Mike Becker <universe@uap-core.de>
date
Fri, 05 Oct 2012 11:55:36 +0200
changeset 49
1771360b740d
parent 48
621a4430c404
child 51
1c78cd19fb6b
permissions
-rw-r--r--

Merge with 22fb97e9f58a0a8b18db7f81b7392dae0cd64571

20
db7d9860dbbd added some map functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1 /*
db7d9860dbbd added some map functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
2 *
db7d9860dbbd added some map functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
3 */
db7d9860dbbd added some map functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
4
db7d9860dbbd added some map functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
5 #include "map_tests.h"
db7d9860dbbd added some map functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
6
44
46356d74e873 added map clone
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 43
diff changeset
7 #ifndef _WIN32
46356d74e873 added map clone
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 43
diff changeset
8 #include <unistd.h>
46356d74e873 added map clone
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 43
diff changeset
9 #endif /* not _WIN32 */
46356d74e873 added map clone
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 43
diff changeset
10
33
9c219a62070d major refactoring of test framework
Mike Becker <universe@uap-core.de>
parents: 32
diff changeset
11 UCX_TEST_IMPLEMENT(test_ucx_map_new) {
20
db7d9860dbbd added some map functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
12 UcxMap *map = ucx_map_new(16);
33
9c219a62070d major refactoring of test framework
Mike Becker <universe@uap-core.de>
parents: 32
diff changeset
13 UCX_TEST_BEGIN
40
583718dd4cf3 added semicolons to assert makros
Mike Becker <universe@uap-core.de>
parents: 34
diff changeset
14 UCX_TEST_ASSERT(map->size == 16, "wrong size");
583718dd4cf3 added semicolons to assert makros
Mike Becker <universe@uap-core.de>
parents: 34
diff changeset
15 UCX_TEST_ASSERT(map->map != NULL, "failed");
29
bce0d7f2912b fixed map with the help of new tests
Mike Becker <universe@uap-core.de>
parents: 20
diff changeset
16
33
9c219a62070d major refactoring of test framework
Mike Becker <universe@uap-core.de>
parents: 32
diff changeset
17 UCX_TEST_END
29
bce0d7f2912b fixed map with the help of new tests
Mike Becker <universe@uap-core.de>
parents: 20
diff changeset
18 ucx_map_free(map);
bce0d7f2912b fixed map with the help of new tests
Mike Becker <universe@uap-core.de>
parents: 20
diff changeset
19 }
20
db7d9860dbbd added some map functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
20
33
9c219a62070d major refactoring of test framework
Mike Becker <universe@uap-core.de>
parents: 32
diff changeset
21 UCX_TEST_IMPLEMENT(test_ucx_key) {
29
bce0d7f2912b fixed map with the help of new tests
Mike Becker <universe@uap-core.de>
parents: 20
diff changeset
22 UcxKey key = ucx_key("This is a text.", 15);
33
9c219a62070d major refactoring of test framework
Mike Becker <universe@uap-core.de>
parents: 32
diff changeset
23 UCX_TEST_BEGIN
40
583718dd4cf3 added semicolons to assert makros
Mike Becker <universe@uap-core.de>
parents: 34
diff changeset
24 UCX_TEST_ASSERT(strncmp(key.data, "This is a text.", 15) == 0, "failed");
583718dd4cf3 added semicolons to assert makros
Mike Becker <universe@uap-core.de>
parents: 34
diff changeset
25 UCX_TEST_ASSERT(key.len == 15, "failed");
583718dd4cf3 added semicolons to assert makros
Mike Becker <universe@uap-core.de>
parents: 34
diff changeset
26 UCX_TEST_ASSERT(key.hash == 1261186027, "hash failed");
29
bce0d7f2912b fixed map with the help of new tests
Mike Becker <universe@uap-core.de>
parents: 20
diff changeset
27
bce0d7f2912b fixed map with the help of new tests
Mike Becker <universe@uap-core.de>
parents: 20
diff changeset
28 UCX_TEST_END
bce0d7f2912b fixed map with the help of new tests
Mike Becker <universe@uap-core.de>
parents: 20
diff changeset
29 }
bce0d7f2912b fixed map with the help of new tests
Mike Becker <universe@uap-core.de>
parents: 20
diff changeset
30
33
9c219a62070d major refactoring of test framework
Mike Becker <universe@uap-core.de>
parents: 32
diff changeset
31 UCX_TEST_IMPLEMENT(test_ucx_map_put) {
29
bce0d7f2912b fixed map with the help of new tests
Mike Becker <universe@uap-core.de>
parents: 20
diff changeset
32
bce0d7f2912b fixed map with the help of new tests
Mike Becker <universe@uap-core.de>
parents: 20
diff changeset
33 UcxMap *map = ucx_map_new(4);
bce0d7f2912b fixed map with the help of new tests
Mike Becker <universe@uap-core.de>
parents: 20
diff changeset
34
bce0d7f2912b fixed map with the help of new tests
Mike Becker <universe@uap-core.de>
parents: 20
diff changeset
35 int td[5];
bce0d7f2912b fixed map with the help of new tests
Mike Becker <universe@uap-core.de>
parents: 20
diff changeset
36 td[0] = 10; td[1] = 42; td[2] = 70; td[3] = 11200; td[4] = 80000;
20
db7d9860dbbd added some map functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
37
33
9c219a62070d major refactoring of test framework
Mike Becker <universe@uap-core.de>
parents: 32
diff changeset
38 UCX_TEST_BEGIN
29
bce0d7f2912b fixed map with the help of new tests
Mike Becker <universe@uap-core.de>
parents: 20
diff changeset
39 ucx_map_cstr_put(map, "Key2", &td[2]); /* 0 */
bce0d7f2912b fixed map with the help of new tests
Mike Becker <universe@uap-core.de>
parents: 20
diff changeset
40 ucx_map_cstr_put(map, "Key0", &td[0]); /* 0 */
bce0d7f2912b fixed map with the help of new tests
Mike Becker <universe@uap-core.de>
parents: 20
diff changeset
41 ucx_map_cstr_put(map, "Key1", &td[1]); /* 3 */
bce0d7f2912b fixed map with the help of new tests
Mike Becker <universe@uap-core.de>
parents: 20
diff changeset
42 ucx_map_cstr_put(map, "KeY3", &td[3]); /* 2 */
bce0d7f2912b fixed map with the help of new tests
Mike Becker <universe@uap-core.de>
parents: 20
diff changeset
43 ucx_map_cstr_put(map, "KEY4", &td[4]); /* 0 */
bce0d7f2912b fixed map with the help of new tests
Mike Becker <universe@uap-core.de>
parents: 20
diff changeset
44
40
583718dd4cf3 added semicolons to assert makros
Mike Becker <universe@uap-core.de>
parents: 34
diff changeset
45 UCX_TEST_ASSERT(*((int*)map->map[0]->data) == td[0], "failed Key0");
583718dd4cf3 added semicolons to assert makros
Mike Becker <universe@uap-core.de>
parents: 34
diff changeset
46 UCX_TEST_ASSERT(map->map[0]->next != NULL, "no list at slot 0");
583718dd4cf3 added semicolons to assert makros
Mike Becker <universe@uap-core.de>
parents: 34
diff changeset
47 UCX_TEST_ASSERT(*((int*)map->map[0]->next->data) == td[2], "failed Key2");
583718dd4cf3 added semicolons to assert makros
Mike Becker <universe@uap-core.de>
parents: 34
diff changeset
48 UCX_TEST_ASSERT(map->map[0]->next->next != NULL, "list corrupt at slot 0");
29
bce0d7f2912b fixed map with the help of new tests
Mike Becker <universe@uap-core.de>
parents: 20
diff changeset
49 UCX_TEST_ASSERT(*((int*)map->map[0]->next->next->data) == td[4],
bce0d7f2912b fixed map with the help of new tests
Mike Becker <universe@uap-core.de>
parents: 20
diff changeset
50 "failed Key4")
bce0d7f2912b fixed map with the help of new tests
Mike Becker <universe@uap-core.de>
parents: 20
diff changeset
51 UCX_TEST_ASSERT(map->map[0]->next->next->next == NULL,
bce0d7f2912b fixed map with the help of new tests
Mike Becker <universe@uap-core.de>
parents: 20
diff changeset
52 "slot 0 not terminated")
bce0d7f2912b fixed map with the help of new tests
Mike Becker <universe@uap-core.de>
parents: 20
diff changeset
53
40
583718dd4cf3 added semicolons to assert makros
Mike Becker <universe@uap-core.de>
parents: 34
diff changeset
54 UCX_TEST_ASSERT(map->map[1] == NULL, "slot 1 not terminated");
29
bce0d7f2912b fixed map with the help of new tests
Mike Becker <universe@uap-core.de>
parents: 20
diff changeset
55
40
583718dd4cf3 added semicolons to assert makros
Mike Becker <universe@uap-core.de>
parents: 34
diff changeset
56 UCX_TEST_ASSERT(*((int*)map->map[2]->data) == td[3], "failed KeY3");
583718dd4cf3 added semicolons to assert makros
Mike Becker <universe@uap-core.de>
parents: 34
diff changeset
57 UCX_TEST_ASSERT(map->map[2]->next == NULL, "slot 2 not terminated");
20
db7d9860dbbd added some map functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
58
40
583718dd4cf3 added semicolons to assert makros
Mike Becker <universe@uap-core.de>
parents: 34
diff changeset
59 UCX_TEST_ASSERT(*((int*)map->map[3]->data) == td[1], "failed Key1");
29
bce0d7f2912b fixed map with the help of new tests
Mike Becker <universe@uap-core.de>
parents: 20
diff changeset
60
bce0d7f2912b fixed map with the help of new tests
Mike Becker <universe@uap-core.de>
parents: 20
diff changeset
61 ucx_map_cstr_put(map, "Key0", &td[3]); /* 0 */
bce0d7f2912b fixed map with the help of new tests
Mike Becker <universe@uap-core.de>
parents: 20
diff changeset
62
40
583718dd4cf3 added semicolons to assert makros
Mike Becker <universe@uap-core.de>
parents: 34
diff changeset
63 UCX_TEST_ASSERT(*((int*)map->map[0]->data) == td[3], "overwrite failed");
29
bce0d7f2912b fixed map with the help of new tests
Mike Becker <universe@uap-core.de>
parents: 20
diff changeset
64 UCX_TEST_ASSERT(*((int*)map->map[0]->next->data) == td[2],
bce0d7f2912b fixed map with the help of new tests
Mike Becker <universe@uap-core.de>
parents: 20
diff changeset
65 "overwrite failed")
bce0d7f2912b fixed map with the help of new tests
Mike Becker <universe@uap-core.de>
parents: 20
diff changeset
66 UCX_TEST_ASSERT(*((int*)map->map[0]->next->next->data) == td[4],
bce0d7f2912b fixed map with the help of new tests
Mike Becker <universe@uap-core.de>
parents: 20
diff changeset
67 "overwrite failed")
40
583718dd4cf3 added semicolons to assert makros
Mike Becker <universe@uap-core.de>
parents: 34
diff changeset
68 UCX_TEST_ASSERT(map->map[0]->next->next->next == NULL, "overwrite failed");
29
bce0d7f2912b fixed map with the help of new tests
Mike Becker <universe@uap-core.de>
parents: 20
diff changeset
69
33
9c219a62070d major refactoring of test framework
Mike Becker <universe@uap-core.de>
parents: 32
diff changeset
70 UCX_TEST_END
29
bce0d7f2912b fixed map with the help of new tests
Mike Becker <universe@uap-core.de>
parents: 20
diff changeset
71 ucx_map_free(map);
33
9c219a62070d major refactoring of test framework
Mike Becker <universe@uap-core.de>
parents: 32
diff changeset
72 }
9c219a62070d major refactoring of test framework
Mike Becker <universe@uap-core.de>
parents: 32
diff changeset
73
9c219a62070d major refactoring of test framework
Mike Becker <universe@uap-core.de>
parents: 32
diff changeset
74 UCX_TEST_IMPLEMENT(test_ucx_map_get) {
34
0dcd2ca2a223 completed map tests
Mike Becker <universe@uap-core.de>
parents: 33
diff changeset
75 UcxMap *map = ucx_map_new(4);
0dcd2ca2a223 completed map tests
Mike Becker <universe@uap-core.de>
parents: 33
diff changeset
76
0dcd2ca2a223 completed map tests
Mike Becker <universe@uap-core.de>
parents: 33
diff changeset
77 int td[5];
0dcd2ca2a223 completed map tests
Mike Becker <universe@uap-core.de>
parents: 33
diff changeset
78 td[0] = 10; td[1] = 42; td[2] = 70; td[3] = 11200; td[4] = 80000;
0dcd2ca2a223 completed map tests
Mike Becker <universe@uap-core.de>
parents: 33
diff changeset
79
0dcd2ca2a223 completed map tests
Mike Becker <universe@uap-core.de>
parents: 33
diff changeset
80 ucx_map_cstr_put(map, "Key2", &td[2]); /* 0 */
0dcd2ca2a223 completed map tests
Mike Becker <universe@uap-core.de>
parents: 33
diff changeset
81 ucx_map_cstr_put(map, "Key0", &td[0]); /* 0 */
0dcd2ca2a223 completed map tests
Mike Becker <universe@uap-core.de>
parents: 33
diff changeset
82 ucx_map_cstr_put(map, "Key1", &td[1]); /* 3 */
0dcd2ca2a223 completed map tests
Mike Becker <universe@uap-core.de>
parents: 33
diff changeset
83 ucx_map_cstr_put(map, "KeY3", &td[3]); /* 2 */
0dcd2ca2a223 completed map tests
Mike Becker <universe@uap-core.de>
parents: 33
diff changeset
84 ucx_map_cstr_put(map, "KEY4", &td[4]); /* 0 */
33
9c219a62070d major refactoring of test framework
Mike Becker <universe@uap-core.de>
parents: 32
diff changeset
85 UCX_TEST_BEGIN
34
0dcd2ca2a223 completed map tests
Mike Becker <universe@uap-core.de>
parents: 33
diff changeset
86
0dcd2ca2a223 completed map tests
Mike Becker <universe@uap-core.de>
parents: 33
diff changeset
87 td[0] = *((int*)ucx_map_cstr_get(map, "Key0"));
0dcd2ca2a223 completed map tests
Mike Becker <universe@uap-core.de>
parents: 33
diff changeset
88 td[1] = *((int*)ucx_map_cstr_get(map, "Key1"));
0dcd2ca2a223 completed map tests
Mike Becker <universe@uap-core.de>
parents: 33
diff changeset
89 td[2] = *((int*)ucx_map_cstr_get(map, "Key2"));
0dcd2ca2a223 completed map tests
Mike Becker <universe@uap-core.de>
parents: 33
diff changeset
90 td[3] = *((int*)ucx_map_cstr_get(map, "KeY3"));
0dcd2ca2a223 completed map tests
Mike Becker <universe@uap-core.de>
parents: 33
diff changeset
91 td[4] = *((int*)ucx_map_cstr_get(map, "KEY4"));
40
583718dd4cf3 added semicolons to assert makros
Mike Becker <universe@uap-core.de>
parents: 34
diff changeset
92 UCX_TEST_ASSERT(td[0] == 10, "failed key 0");
583718dd4cf3 added semicolons to assert makros
Mike Becker <universe@uap-core.de>
parents: 34
diff changeset
93 UCX_TEST_ASSERT(td[1] == 42, "failed key 1");
583718dd4cf3 added semicolons to assert makros
Mike Becker <universe@uap-core.de>
parents: 34
diff changeset
94 UCX_TEST_ASSERT(td[2] == 70, "failed key 2");
583718dd4cf3 added semicolons to assert makros
Mike Becker <universe@uap-core.de>
parents: 34
diff changeset
95 UCX_TEST_ASSERT(td[3] == 11200, "failed key 3");
583718dd4cf3 added semicolons to assert makros
Mike Becker <universe@uap-core.de>
parents: 34
diff changeset
96 UCX_TEST_ASSERT(td[4] == 80000, "failed key 4");
34
0dcd2ca2a223 completed map tests
Mike Becker <universe@uap-core.de>
parents: 33
diff changeset
97
29
bce0d7f2912b fixed map with the help of new tests
Mike Becker <universe@uap-core.de>
parents: 20
diff changeset
98 UCX_TEST_END
34
0dcd2ca2a223 completed map tests
Mike Becker <universe@uap-core.de>
parents: 33
diff changeset
99 ucx_map_free(map);
20
db7d9860dbbd added some map functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
100 }
29
bce0d7f2912b fixed map with the help of new tests
Mike Becker <universe@uap-core.de>
parents: 20
diff changeset
101
33
9c219a62070d major refactoring of test framework
Mike Becker <universe@uap-core.de>
parents: 32
diff changeset
102 UCX_TEST_SUBROUTINE(test_ucx_map_itersrt, mapptr) {
9c219a62070d major refactoring of test framework
Mike Becker <universe@uap-core.de>
parents: 32
diff changeset
103 UcxMap *map = (UcxMap*) mapptr;
31
91ac86557290 added map iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 29
diff changeset
104 int v1 = 10;
91ac86557290 added map iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 29
diff changeset
105 int v2 = 15;
91ac86557290 added map iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 29
diff changeset
106 int v3 = 7;
91ac86557290 added map iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 29
diff changeset
107 int v4 = 9;
32
c7af4ec56e19 consequently used intptr_t in mpool tests
Mike Becker <universe@uap-core.de>
parents: 31
diff changeset
108
31
91ac86557290 added map iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 29
diff changeset
109 ucx_map_cstr_put(map, "v1", &v1);
91ac86557290 added map iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 29
diff changeset
110 ucx_map_cstr_put(map, "v2", &v2);
91ac86557290 added map iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 29
diff changeset
111 ucx_map_cstr_put(map, "v3", &v3);
91ac86557290 added map iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 29
diff changeset
112 ucx_map_cstr_put(map, "v4", &v4);
32
c7af4ec56e19 consequently used intptr_t in mpool tests
Mike Becker <universe@uap-core.de>
parents: 31
diff changeset
113
31
91ac86557290 added map iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 29
diff changeset
114 UcxMapIterator i = ucx_map_iterator(map);
91ac86557290 added map iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 29
diff changeset
115 int check = 0;
91ac86557290 added map iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 29
diff changeset
116 int hit = 0;
32
c7af4ec56e19 consequently used intptr_t in mpool tests
Mike Becker <universe@uap-core.de>
parents: 31
diff changeset
117
41
7f90a03e186e simplified UCX_MAP_FOREACH
Mike Becker <universe@uap-core.de>
parents: 40
diff changeset
118 int* v;
7f90a03e186e simplified UCX_MAP_FOREACH
Mike Becker <universe@uap-core.de>
parents: 40
diff changeset
119 UCX_MAP_FOREACH(v, i) {
31
91ac86557290 added map iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 29
diff changeset
120 check += *v;
91ac86557290 added map iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 29
diff changeset
121 hit++;
91ac86557290 added map iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 29
diff changeset
122 }
32
c7af4ec56e19 consequently used intptr_t in mpool tests
Mike Becker <universe@uap-core.de>
parents: 31
diff changeset
123
31
91ac86557290 added map iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 29
diff changeset
124 UCX_TEST_ASSERT(hit == 4, "test1: wrong number of hits");
91ac86557290 added map iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 29
diff changeset
125 UCX_TEST_ASSERT(check == v1+v2+v3+v4, "test1: wrong result");
33
9c219a62070d major refactoring of test framework
Mike Becker <universe@uap-core.de>
parents: 32
diff changeset
126 }
32
c7af4ec56e19 consequently used intptr_t in mpool tests
Mike Becker <universe@uap-core.de>
parents: 31
diff changeset
127
33
9c219a62070d major refactoring of test framework
Mike Becker <universe@uap-core.de>
parents: 32
diff changeset
128 UCX_TEST_IMPLEMENT(test_ucx_map_iterator) {
9c219a62070d major refactoring of test framework
Mike Becker <universe@uap-core.de>
parents: 32
diff changeset
129 UcxMap *map = ucx_map_new(16);
9c219a62070d major refactoring of test framework
Mike Becker <universe@uap-core.de>
parents: 32
diff changeset
130 UCX_TEST_BEGIN
9c219a62070d major refactoring of test framework
Mike Becker <universe@uap-core.de>
parents: 32
diff changeset
131 UCX_TEST_CALL_SUBROUTINE(test_ucx_map_itersrt, map)
9c219a62070d major refactoring of test framework
Mike Becker <universe@uap-core.de>
parents: 32
diff changeset
132 UCX_TEST_END
31
91ac86557290 added map iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 29
diff changeset
133 ucx_map_free(map);
33
9c219a62070d major refactoring of test framework
Mike Becker <universe@uap-core.de>
parents: 32
diff changeset
134 }
9c219a62070d major refactoring of test framework
Mike Becker <universe@uap-core.de>
parents: 32
diff changeset
135
9c219a62070d major refactoring of test framework
Mike Becker <universe@uap-core.de>
parents: 32
diff changeset
136 UCX_TEST_IMPLEMENT(test_ucx_map_iterator_chain) {
9c219a62070d major refactoring of test framework
Mike Becker <universe@uap-core.de>
parents: 32
diff changeset
137 UcxMap *map = ucx_map_new(1);
9c219a62070d major refactoring of test framework
Mike Becker <universe@uap-core.de>
parents: 32
diff changeset
138 UCX_TEST_BEGIN
9c219a62070d major refactoring of test framework
Mike Becker <universe@uap-core.de>
parents: 32
diff changeset
139 UCX_TEST_CALL_SUBROUTINE(test_ucx_map_itersrt, map)
9c219a62070d major refactoring of test framework
Mike Becker <universe@uap-core.de>
parents: 32
diff changeset
140 UCX_TEST_END
31
91ac86557290 added map iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 29
diff changeset
141 ucx_map_free(map);
91ac86557290 added map iterator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 29
diff changeset
142 }
42
ff3dd1ee7dee (broken-commit) - added load and store functions, tests failing
Mike Becker <universe@uap-core.de>
parents: 41
diff changeset
143
48
621a4430c404 map can now load values from file into pooled memory
Mike Becker <universe@uap-core.de>
parents: 46
diff changeset
144 void* test_ucx_map_store_load_encdec(void *value, void *data, size_t *size) {
46
48ca036d7d9c implemented encoder/decoder for map store/load
Mike Becker <universe@uap-core.de>
parents: 44
diff changeset
145 char *string = (char*) value;
48ca036d7d9c implemented encoder/decoder for map store/load
Mike Becker <universe@uap-core.de>
parents: 44
diff changeset
146 size_t n = strlen(string);
48ca036d7d9c implemented encoder/decoder for map store/load
Mike Becker <universe@uap-core.de>
parents: 44
diff changeset
147 char *encoded = malloc(n+1);
48ca036d7d9c implemented encoder/decoder for map store/load
Mike Becker <universe@uap-core.de>
parents: 44
diff changeset
148 for (int i = 0 ; i < n ; i++) {
48ca036d7d9c implemented encoder/decoder for map store/load
Mike Becker <universe@uap-core.de>
parents: 44
diff changeset
149 encoded[i] = string[n-1-i];
48ca036d7d9c implemented encoder/decoder for map store/load
Mike Becker <universe@uap-core.de>
parents: 44
diff changeset
150 }
48ca036d7d9c implemented encoder/decoder for map store/load
Mike Becker <universe@uap-core.de>
parents: 44
diff changeset
151 encoded[n] = 0;
48
621a4430c404 map can now load values from file into pooled memory
Mike Becker <universe@uap-core.de>
parents: 46
diff changeset
152 *size = n+1;
46
48ca036d7d9c implemented encoder/decoder for map store/load
Mike Becker <universe@uap-core.de>
parents: 44
diff changeset
153 return encoded;
48ca036d7d9c implemented encoder/decoder for map store/load
Mike Becker <universe@uap-core.de>
parents: 44
diff changeset
154 }
48ca036d7d9c implemented encoder/decoder for map store/load
Mike Becker <universe@uap-core.de>
parents: 44
diff changeset
155
42
ff3dd1ee7dee (broken-commit) - added load and store functions, tests failing
Mike Becker <universe@uap-core.de>
parents: 41
diff changeset
156 UCX_TEST_IMPLEMENT(test_ucx_map_store_load) {
ff3dd1ee7dee (broken-commit) - added load and store functions, tests failing
Mike Becker <universe@uap-core.de>
parents: 41
diff changeset
157 UcxMap *map = ucx_map_new(4);
ff3dd1ee7dee (broken-commit) - added load and store functions, tests failing
Mike Becker <universe@uap-core.de>
parents: 41
diff changeset
158
ff3dd1ee7dee (broken-commit) - added load and store functions, tests failing
Mike Becker <universe@uap-core.de>
parents: 41
diff changeset
159 ucx_map_cstr_put(map, "test", "test");
ff3dd1ee7dee (broken-commit) - added load and store functions, tests failing
Mike Becker <universe@uap-core.de>
parents: 41
diff changeset
160 ucx_map_cstr_put(map, "key", "value");
ff3dd1ee7dee (broken-commit) - added load and store functions, tests failing
Mike Becker <universe@uap-core.de>
parents: 41
diff changeset
161 ucx_map_cstr_put(map, "other.very.long.key", "value");
ff3dd1ee7dee (broken-commit) - added load and store functions, tests failing
Mike Becker <universe@uap-core.de>
parents: 41
diff changeset
162 ucx_map_cstr_put(map, "testkey", "testvalue");
ff3dd1ee7dee (broken-commit) - added load and store functions, tests failing
Mike Becker <universe@uap-core.de>
parents: 41
diff changeset
163 ucx_map_cstr_put(map, "simple", "not a key but an extremely long value "
ff3dd1ee7dee (broken-commit) - added load and store functions, tests failing
Mike Becker <universe@uap-core.de>
parents: 41
diff changeset
164 "to test if the buffer extension works as designed");
ff3dd1ee7dee (broken-commit) - added load and store functions, tests failing
Mike Becker <universe@uap-core.de>
parents: 41
diff changeset
165
ff3dd1ee7dee (broken-commit) - added load and store functions, tests failing
Mike Becker <universe@uap-core.de>
parents: 41
diff changeset
166 FILE *f = fopen("test_ucx_map_store", "w");
ff3dd1ee7dee (broken-commit) - added load and store functions, tests failing
Mike Becker <universe@uap-core.de>
parents: 41
diff changeset
167 int r;
ff3dd1ee7dee (broken-commit) - added load and store functions, tests failing
Mike Becker <universe@uap-core.de>
parents: 41
diff changeset
168
43
02f38adea013 fixed crash fails by completing the implementation of the tested function....
Mike Becker <universe@uap-core.de>
parents: 42
diff changeset
169 fwrite(" # comment test\n", 1, 16, f);
46
48ca036d7d9c implemented encoder/decoder for map store/load
Mike Becker <universe@uap-core.de>
parents: 44
diff changeset
170 r = ucx_map_store_enc(map, f, test_ucx_map_store_load_encdec, NULL);
43
02f38adea013 fixed crash fails by completing the implementation of the tested function....
Mike Becker <universe@uap-core.de>
parents: 42
diff changeset
171 fwrite("!discard this", 1, 13, f);
42
ff3dd1ee7dee (broken-commit) - added load and store functions, tests failing
Mike Becker <universe@uap-core.de>
parents: 41
diff changeset
172
ff3dd1ee7dee (broken-commit) - added load and store functions, tests failing
Mike Becker <universe@uap-core.de>
parents: 41
diff changeset
173 fclose(f);
ff3dd1ee7dee (broken-commit) - added load and store functions, tests failing
Mike Becker <universe@uap-core.de>
parents: 41
diff changeset
174 ucx_map_free(map);
ff3dd1ee7dee (broken-commit) - added load and store functions, tests failing
Mike Becker <universe@uap-core.de>
parents: 41
diff changeset
175 map = ucx_map_new(1);
ff3dd1ee7dee (broken-commit) - added load and store functions, tests failing
Mike Becker <universe@uap-core.de>
parents: 41
diff changeset
176 f = fopen("test_ucx_map_store", "r");
48
621a4430c404 map can now load values from file into pooled memory
Mike Becker <universe@uap-core.de>
parents: 46
diff changeset
177 UcxAllocator allocator = UCX_ALLOCATOR_DEFAULT;
621a4430c404 map can now load values from file into pooled memory
Mike Becker <universe@uap-core.de>
parents: 46
diff changeset
178 r += ucx_map_load_enc(map, f, allocator,
621a4430c404 map can now load values from file into pooled memory
Mike Becker <universe@uap-core.de>
parents: 46
diff changeset
179 test_ucx_map_store_load_encdec, NULL);
621a4430c404 map can now load values from file into pooled memory
Mike Becker <universe@uap-core.de>
parents: 46
diff changeset
180 fclose(f);
621a4430c404 map can now load values from file into pooled memory
Mike Becker <universe@uap-core.de>
parents: 46
diff changeset
181 unlink("test_ucx_map_store");
42
ff3dd1ee7dee (broken-commit) - added load and store functions, tests failing
Mike Becker <universe@uap-core.de>
parents: 41
diff changeset
182
ff3dd1ee7dee (broken-commit) - added load and store functions, tests failing
Mike Becker <universe@uap-core.de>
parents: 41
diff changeset
183 UCX_TEST_BEGIN
ff3dd1ee7dee (broken-commit) - added load and store functions, tests failing
Mike Becker <universe@uap-core.de>
parents: 41
diff changeset
184 char *value;
ff3dd1ee7dee (broken-commit) - added load and store functions, tests failing
Mike Becker <universe@uap-core.de>
parents: 41
diff changeset
185 UCX_TEST_ASSERT(r == 0, "IO errors, test cannot be performed");
ff3dd1ee7dee (broken-commit) - added load and store functions, tests failing
Mike Becker <universe@uap-core.de>
parents: 41
diff changeset
186
ff3dd1ee7dee (broken-commit) - added load and store functions, tests failing
Mike Becker <universe@uap-core.de>
parents: 41
diff changeset
187 value = ucx_map_cstr_get(map, "test");
43
02f38adea013 fixed crash fails by completing the implementation of the tested function....
Mike Becker <universe@uap-core.de>
parents: 42
diff changeset
188 UCX_TEST_ASSERT(value != NULL, "value not found for key: test");
42
ff3dd1ee7dee (broken-commit) - added load and store functions, tests failing
Mike Becker <universe@uap-core.de>
parents: 41
diff changeset
189 UCX_TEST_ASSERT(strcmp(value, "test") == 0, "value error for key: test");
ff3dd1ee7dee (broken-commit) - added load and store functions, tests failing
Mike Becker <universe@uap-core.de>
parents: 41
diff changeset
190
ff3dd1ee7dee (broken-commit) - added load and store functions, tests failing
Mike Becker <universe@uap-core.de>
parents: 41
diff changeset
191 value = ucx_map_cstr_get(map, "key");
43
02f38adea013 fixed crash fails by completing the implementation of the tested function....
Mike Becker <universe@uap-core.de>
parents: 42
diff changeset
192 UCX_TEST_ASSERT(value != NULL, "value not found for key: key");
42
ff3dd1ee7dee (broken-commit) - added load and store functions, tests failing
Mike Becker <universe@uap-core.de>
parents: 41
diff changeset
193 UCX_TEST_ASSERT(strcmp(value, "value") == 0, "value error for key: key");
ff3dd1ee7dee (broken-commit) - added load and store functions, tests failing
Mike Becker <universe@uap-core.de>
parents: 41
diff changeset
194
ff3dd1ee7dee (broken-commit) - added load and store functions, tests failing
Mike Becker <universe@uap-core.de>
parents: 41
diff changeset
195 value = ucx_map_cstr_get(map, "other.very.long.key");
43
02f38adea013 fixed crash fails by completing the implementation of the tested function....
Mike Becker <universe@uap-core.de>
parents: 42
diff changeset
196 UCX_TEST_ASSERT(value != NULL,
02f38adea013 fixed crash fails by completing the implementation of the tested function....
Mike Becker <universe@uap-core.de>
parents: 42
diff changeset
197 "value not found for key: other.very.long.key");
42
ff3dd1ee7dee (broken-commit) - added load and store functions, tests failing
Mike Becker <universe@uap-core.de>
parents: 41
diff changeset
198 UCX_TEST_ASSERT(strcmp(value, "value") == 0,
ff3dd1ee7dee (broken-commit) - added load and store functions, tests failing
Mike Becker <universe@uap-core.de>
parents: 41
diff changeset
199 "value error for key: other.very.long.key");
ff3dd1ee7dee (broken-commit) - added load and store functions, tests failing
Mike Becker <universe@uap-core.de>
parents: 41
diff changeset
200
ff3dd1ee7dee (broken-commit) - added load and store functions, tests failing
Mike Becker <universe@uap-core.de>
parents: 41
diff changeset
201 value = ucx_map_cstr_get(map, "testkey");
43
02f38adea013 fixed crash fails by completing the implementation of the tested function....
Mike Becker <universe@uap-core.de>
parents: 42
diff changeset
202 UCX_TEST_ASSERT(value != NULL, "value not found for key: testkey");
42
ff3dd1ee7dee (broken-commit) - added load and store functions, tests failing
Mike Becker <universe@uap-core.de>
parents: 41
diff changeset
203 UCX_TEST_ASSERT(strcmp(value, "testvalue") == 0,
ff3dd1ee7dee (broken-commit) - added load and store functions, tests failing
Mike Becker <universe@uap-core.de>
parents: 41
diff changeset
204 "value error for key: testkey");
ff3dd1ee7dee (broken-commit) - added load and store functions, tests failing
Mike Becker <universe@uap-core.de>
parents: 41
diff changeset
205
ff3dd1ee7dee (broken-commit) - added load and store functions, tests failing
Mike Becker <universe@uap-core.de>
parents: 41
diff changeset
206 value = ucx_map_cstr_get(map, "simple");
43
02f38adea013 fixed crash fails by completing the implementation of the tested function....
Mike Becker <universe@uap-core.de>
parents: 42
diff changeset
207 UCX_TEST_ASSERT(value != NULL, "value not found for key: simple");
42
ff3dd1ee7dee (broken-commit) - added load and store functions, tests failing
Mike Becker <universe@uap-core.de>
parents: 41
diff changeset
208 UCX_TEST_ASSERT(strcmp(value, "not a key but an extremely long value "
ff3dd1ee7dee (broken-commit) - added load and store functions, tests failing
Mike Becker <universe@uap-core.de>
parents: 41
diff changeset
209 "to test if the buffer extension works as designed") == 0,
ff3dd1ee7dee (broken-commit) - added load and store functions, tests failing
Mike Becker <universe@uap-core.de>
parents: 41
diff changeset
210 "value error for key: simple");
ff3dd1ee7dee (broken-commit) - added load and store functions, tests failing
Mike Becker <universe@uap-core.de>
parents: 41
diff changeset
211
ff3dd1ee7dee (broken-commit) - added load and store functions, tests failing
Mike Becker <universe@uap-core.de>
parents: 41
diff changeset
212 UCX_TEST_END
48
621a4430c404 map can now load values from file into pooled memory
Mike Becker <universe@uap-core.de>
parents: 46
diff changeset
213 }
621a4430c404 map can now load values from file into pooled memory
Mike Becker <universe@uap-core.de>
parents: 46
diff changeset
214
621a4430c404 map can now load values from file into pooled memory
Mike Becker <universe@uap-core.de>
parents: 46
diff changeset
215 UCX_TEST_IMPLEMENT(test_ucx_map_store_load_with_mempool) {
621a4430c404 map can now load values from file into pooled memory
Mike Becker <universe@uap-core.de>
parents: 46
diff changeset
216 UcxMap *map = ucx_map_new(4);
621a4430c404 map can now load values from file into pooled memory
Mike Becker <universe@uap-core.de>
parents: 46
diff changeset
217
621a4430c404 map can now load values from file into pooled memory
Mike Becker <universe@uap-core.de>
parents: 46
diff changeset
218 ucx_map_cstr_put(map, "test", "test");
621a4430c404 map can now load values from file into pooled memory
Mike Becker <universe@uap-core.de>
parents: 46
diff changeset
219 ucx_map_cstr_put(map, "key", "value");
621a4430c404 map can now load values from file into pooled memory
Mike Becker <universe@uap-core.de>
parents: 46
diff changeset
220 ucx_map_cstr_put(map, "testkey", "testvalue");
621a4430c404 map can now load values from file into pooled memory
Mike Becker <universe@uap-core.de>
parents: 46
diff changeset
221 ucx_map_cstr_put(map, "simple", "a simple value");
621a4430c404 map can now load values from file into pooled memory
Mike Becker <universe@uap-core.de>
parents: 46
diff changeset
222
621a4430c404 map can now load values from file into pooled memory
Mike Becker <universe@uap-core.de>
parents: 46
diff changeset
223 FILE *f = fopen("test_ucx_map_store", "w");
621a4430c404 map can now load values from file into pooled memory
Mike Becker <universe@uap-core.de>
parents: 46
diff changeset
224 int r;
621a4430c404 map can now load values from file into pooled memory
Mike Becker <universe@uap-core.de>
parents: 46
diff changeset
225 r = ucx_map_store_enc(map, f, NULL, NULL);
42
ff3dd1ee7dee (broken-commit) - added load and store functions, tests failing
Mike Becker <universe@uap-core.de>
parents: 41
diff changeset
226 fclose(f);
48
621a4430c404 map can now load values from file into pooled memory
Mike Becker <universe@uap-core.de>
parents: 46
diff changeset
227 ucx_map_free(map);
42
ff3dd1ee7dee (broken-commit) - added load and store functions, tests failing
Mike Becker <universe@uap-core.de>
parents: 41
diff changeset
228
48
621a4430c404 map can now load values from file into pooled memory
Mike Becker <universe@uap-core.de>
parents: 46
diff changeset
229 UcxMempool *pool = ucx_mempool_new(4);
621a4430c404 map can now load values from file into pooled memory
Mike Becker <universe@uap-core.de>
parents: 46
diff changeset
230 map = ucx_map_new(4);
621a4430c404 map can now load values from file into pooled memory
Mike Becker <universe@uap-core.de>
parents: 46
diff changeset
231 f = fopen("test_ucx_map_store", "r");
621a4430c404 map can now load values from file into pooled memory
Mike Becker <universe@uap-core.de>
parents: 46
diff changeset
232 UcxAllocator allocator = UCX_ALLOCATOR_MEMPOOL(pool);
621a4430c404 map can now load values from file into pooled memory
Mike Becker <universe@uap-core.de>
parents: 46
diff changeset
233 r += ucx_map_load_enc(map, f, allocator,
621a4430c404 map can now load values from file into pooled memory
Mike Becker <universe@uap-core.de>
parents: 46
diff changeset
234 test_ucx_map_store_load_encdec, NULL);
621a4430c404 map can now load values from file into pooled memory
Mike Becker <universe@uap-core.de>
parents: 46
diff changeset
235 fclose(f);
42
ff3dd1ee7dee (broken-commit) - added load and store functions, tests failing
Mike Becker <universe@uap-core.de>
parents: 41
diff changeset
236 unlink("test_ucx_map_store");
48
621a4430c404 map can now load values from file into pooled memory
Mike Becker <universe@uap-core.de>
parents: 46
diff changeset
237
621a4430c404 map can now load values from file into pooled memory
Mike Becker <universe@uap-core.de>
parents: 46
diff changeset
238 UCX_TEST_BEGIN
621a4430c404 map can now load values from file into pooled memory
Mike Becker <universe@uap-core.de>
parents: 46
diff changeset
239 UCX_TEST_ASSERT(r == 0, "IO errors, test cannot be performed");
621a4430c404 map can now load values from file into pooled memory
Mike Becker <universe@uap-core.de>
parents: 46
diff changeset
240 UcxMapIterator iter = ucx_map_iterator(map);
621a4430c404 map can now load values from file into pooled memory
Mike Becker <universe@uap-core.de>
parents: 46
diff changeset
241 char *value; size_t n;
621a4430c404 map can now load values from file into pooled memory
Mike Becker <universe@uap-core.de>
parents: 46
diff changeset
242 UCX_MAP_FOREACH(value, iter) {
621a4430c404 map can now load values from file into pooled memory
Mike Becker <universe@uap-core.de>
parents: 46
diff changeset
243 n = strlen(value);
621a4430c404 map can now load values from file into pooled memory
Mike Becker <universe@uap-core.de>
parents: 46
diff changeset
244 UCX_TEST_ASSERT(strncmp(pool->data[iter.index], value, n),
621a4430c404 map can now load values from file into pooled memory
Mike Becker <universe@uap-core.de>
parents: 46
diff changeset
245 "values of map does not match pooled values");
621a4430c404 map can now load values from file into pooled memory
Mike Becker <universe@uap-core.de>
parents: 46
diff changeset
246 }
621a4430c404 map can now load values from file into pooled memory
Mike Becker <universe@uap-core.de>
parents: 46
diff changeset
247 UCX_TEST_END
621a4430c404 map can now load values from file into pooled memory
Mike Becker <universe@uap-core.de>
parents: 46
diff changeset
248
621a4430c404 map can now load values from file into pooled memory
Mike Becker <universe@uap-core.de>
parents: 46
diff changeset
249 ucx_mempool_free(pool);
42
ff3dd1ee7dee (broken-commit) - added load and store functions, tests failing
Mike Becker <universe@uap-core.de>
parents: 41
diff changeset
250 }
44
46356d74e873 added map clone
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 43
diff changeset
251
46356d74e873 added map clone
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 43
diff changeset
252 UCX_TEST_IMPLEMENT(test_ucx_map_clone) {
46356d74e873 added map clone
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 43
diff changeset
253 UcxMap *map = ucx_map_new(4);
46356d74e873 added map clone
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 43
diff changeset
254
46356d74e873 added map clone
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 43
diff changeset
255 ucx_map_cstr_put(map, "key1", "value1");
46356d74e873 added map clone
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 43
diff changeset
256 ucx_map_cstr_put(map, "key2", "value2");
46356d74e873 added map clone
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 43
diff changeset
257 ucx_map_cstr_put(map, "key3", "value3");
46356d74e873 added map clone
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 43
diff changeset
258
46356d74e873 added map clone
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 43
diff changeset
259 UcxMap *clone = ucx_map_clone(map, NULL, NULL);
46356d74e873 added map clone
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 43
diff changeset
260
46356d74e873 added map clone
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 43
diff changeset
261 char *v1 = ucx_map_cstr_get(map, "key1");
46356d74e873 added map clone
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 43
diff changeset
262 char *v2 = ucx_map_cstr_get(map, "key2");
46356d74e873 added map clone
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 43
diff changeset
263 char *v3 = ucx_map_cstr_get(map, "key3");
46356d74e873 added map clone
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 43
diff changeset
264
46356d74e873 added map clone
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 43
diff changeset
265 UCX_TEST_BEGIN
46356d74e873 added map clone
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 43
diff changeset
266
46356d74e873 added map clone
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 43
diff changeset
267 UCX_TEST_ASSERT(v1 != NULL, "failed key 1");
46356d74e873 added map clone
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 43
diff changeset
268 UCX_TEST_ASSERT(v2 != NULL, "failed key 2");
46356d74e873 added map clone
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 43
diff changeset
269 UCX_TEST_ASSERT(v3 != NULL, "failed key 3");
46356d74e873 added map clone
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 43
diff changeset
270
46356d74e873 added map clone
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 43
diff changeset
271 char *c1 = ucx_map_cstr_get(clone, "key1");
46356d74e873 added map clone
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 43
diff changeset
272 char *c2 = ucx_map_cstr_get(clone, "key2");
46356d74e873 added map clone
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 43
diff changeset
273 char *c3 = ucx_map_cstr_get(clone, "key3");
46356d74e873 added map clone
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 43
diff changeset
274
46356d74e873 added map clone
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 43
diff changeset
275 UCX_TEST_ASSERT(c1 != NULL, "failed key 1 (clone)");
46356d74e873 added map clone
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 43
diff changeset
276 UCX_TEST_ASSERT(c2 != NULL, "failed key 2 (clone)");
46356d74e873 added map clone
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 43
diff changeset
277 UCX_TEST_ASSERT(c3 != NULL, "failed key 3 (clone)");
46356d74e873 added map clone
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 43
diff changeset
278
46356d74e873 added map clone
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 43
diff changeset
279 UCX_TEST_ASSERT(strcmp(c1, v1) == 0, "value error for key1");
46356d74e873 added map clone
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 43
diff changeset
280 UCX_TEST_ASSERT(strcmp(c2, v2) == 0, "value error for key2");
46356d74e873 added map clone
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 43
diff changeset
281 UCX_TEST_ASSERT(strcmp(c3, v3) == 0, "value error for key3");
46356d74e873 added map clone
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 43
diff changeset
282
46356d74e873 added map clone
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 43
diff changeset
283 UCX_TEST_END
46356d74e873 added map clone
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 43
diff changeset
284
46356d74e873 added map clone
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 43
diff changeset
285 ucx_map_free(map);
46356d74e873 added map clone
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 43
diff changeset
286 ucx_map_free(clone);
46356d74e873 added map clone
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 43
diff changeset
287 }

mercurial