• Home
  • Raw
  • Download

Lines Matching refs:map

48 	struct hashmap *map;  in test_hashmap_generic()  local
50 map = hashmap__new(hash_fn, equal_fn, NULL); in test_hashmap_generic()
51 if (CHECK(IS_ERR(map), "hashmap__new", in test_hashmap_generic()
52 "failed to create map: %ld\n", PTR_ERR(map))) in test_hashmap_generic()
59 err = hashmap__update(map, k, v, &oldk, &oldv); in test_hashmap_generic()
65 err = hashmap__add(map, k, v); in test_hashmap_generic()
67 err = hashmap__set(map, k, v, &oldk, &oldv); in test_hashmap_generic()
77 if (CHECK(!hashmap__find(map, k, &oldv), "elem_find", in test_hashmap_generic()
85 if (CHECK(hashmap__size(map) != ELEM_CNT, "hashmap__size", in test_hashmap_generic()
86 "invalid map size: %zu\n", hashmap__size(map))) in test_hashmap_generic()
88 if (CHECK(hashmap__capacity(map) != exp_cap(hashmap__size(map)), in test_hashmap_generic()
90 "unexpected map capacity: %zu\n", hashmap__capacity(map))) in test_hashmap_generic()
94 hashmap__for_each_entry(map, entry, bkt) { in test_hashmap_generic()
111 err = hashmap__add(map, k, v); in test_hashmap_generic()
117 err = hashmap__update(map, k, v, &oldk, &oldv); in test_hashmap_generic()
119 err = hashmap__set(map, k, v, &oldk, &oldv); in test_hashmap_generic()
125 if (CHECK(!hashmap__find(map, k, &oldv), "elem_find", in test_hashmap_generic()
133 if (CHECK(hashmap__size(map) != ELEM_CNT, "hashmap__size", in test_hashmap_generic()
134 "invalid updated map size: %zu\n", hashmap__size(map))) in test_hashmap_generic()
136 if (CHECK(hashmap__capacity(map) != exp_cap(hashmap__size(map)), in test_hashmap_generic()
138 "unexpected map capacity: %zu\n", hashmap__capacity(map))) in test_hashmap_generic()
142 hashmap__for_each_entry_safe(map, entry, tmp, bkt) { in test_hashmap_generic()
156 hashmap__for_each_key_entry(map, entry, (void *)0) { in test_hashmap_generic()
165 hashmap__for_each_key_entry_safe(map, entry, tmp, (void *)0) { in test_hashmap_generic()
175 if (CHECK(!hashmap__delete(map, k, &oldk, &oldv), "elem_del", in test_hashmap_generic()
183 if (CHECK(hashmap__delete(map, k, &oldk, &oldv), "elem_del", in test_hashmap_generic()
192 if (CHECK(hashmap__size(map) != ELEM_CNT - found_cnt, "elem_cnt", in test_hashmap_generic()
194 found_cnt, hashmap__size(map))) in test_hashmap_generic()
196 if (CHECK(hashmap__capacity(map) != exp_cap(hashmap__size(map)), in test_hashmap_generic()
198 "unexpected map capacity: %zu\n", hashmap__capacity(map))) in test_hashmap_generic()
201 hashmap__for_each_entry_safe(map, entry, tmp, bkt) { in test_hashmap_generic()
211 if (CHECK(!hashmap__delete(map, k, &oldk, &oldv), "elem_del", in test_hashmap_generic()
219 if (CHECK(hashmap__delete(map, k, &oldk, &oldv), "elem_del", in test_hashmap_generic()
230 if (CHECK(hashmap__size(map) != 0, "hashmap__size", in test_hashmap_generic()
232 found_cnt, hashmap__size(map))) in test_hashmap_generic()
236 hashmap__for_each_entry(map, entry, bkt) { in test_hashmap_generic()
243 hashmap__clear(map); in test_hashmap_generic()
244 hashmap__for_each_entry(map, entry, bkt) { in test_hashmap_generic()
252 hashmap__free(map); in test_hashmap_generic()
264 struct hashmap *map; in test_hashmap_multimap() local
269 map = hashmap__new(collision_hash_fn, equal_fn, NULL); in test_hashmap_multimap()
270 if (CHECK(IS_ERR(map), "hashmap__new", in test_hashmap_multimap()
271 "failed to create map: %ld\n", PTR_ERR(map))) in test_hashmap_multimap()
278 err = hashmap__append(map, k1, (void *)1); in test_hashmap_multimap()
281 err = hashmap__append(map, k1, (void *)2); in test_hashmap_multimap()
284 err = hashmap__append(map, k1, (void *)4); in test_hashmap_multimap()
288 err = hashmap__append(map, k2, (void *)8); in test_hashmap_multimap()
291 err = hashmap__append(map, k2, (void *)16); in test_hashmap_multimap()
294 err = hashmap__append(map, k2, (void *)32); in test_hashmap_multimap()
298 if (CHECK(hashmap__size(map) != 6, "hashmap_size", in test_hashmap_multimap()
299 "invalid map size: %zu\n", hashmap__size(map))) in test_hashmap_multimap()
304 hashmap__for_each_entry(map, entry, bkt) { in test_hashmap_multimap()
313 hashmap__for_each_key_entry(map, entry, k1) { in test_hashmap_multimap()
322 hashmap__for_each_key_entry(map, entry, k2) { in test_hashmap_multimap()
330 hashmap__free(map); in test_hashmap_multimap()
337 struct hashmap *map; in test_hashmap_empty() local
341 map = hashmap__new(hash_fn, equal_fn, NULL); in test_hashmap_empty()
342 if (CHECK(IS_ERR(map), "hashmap__new", in test_hashmap_empty()
343 "failed to create map: %ld\n", PTR_ERR(map))) in test_hashmap_empty()
346 if (CHECK(hashmap__size(map) != 0, "hashmap__size", in test_hashmap_empty()
347 "invalid map size: %zu\n", hashmap__size(map))) in test_hashmap_empty()
349 if (CHECK(hashmap__capacity(map) != 0, "hashmap__capacity", in test_hashmap_empty()
350 "invalid map capacity: %zu\n", hashmap__capacity(map))) in test_hashmap_empty()
352 if (CHECK(hashmap__find(map, k, NULL), "elem_find", in test_hashmap_empty()
355 if (CHECK(hashmap__delete(map, k, NULL, NULL), "elem_del", in test_hashmap_empty()
359 hashmap__for_each_entry(map, entry, bkt) { in test_hashmap_empty()
363 hashmap__for_each_key_entry(map, entry, k) { in test_hashmap_empty()
369 hashmap__free(map); in test_hashmap_empty()