1 /*
2 * Copyright (c) 2022 Meta
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
7 #include <stdlib.h>
8
9 #include <zephyr/ztest.h>
10 #include <zephyr/sys/hash_map.h>
11
12 #include "_main.h"
13
14 SYS_HASHMAP_DEFINE(map);
15 SYS_HASHMAP_DEFAULT_DEFINE_ADVANCED(custom_load_factor_map, sys_hash32, realloc,
16 SYS_HASHMAP_CONFIG(SIZE_MAX, CUSTOM_LOAD_FACTOR));
17
setup(void)18 static void *setup(void)
19 {
20 printk("CONFIG_TEST_LIB_HASH_MAP_MAX_ENTRIES: %u\n", CONFIG_TEST_LIB_HASH_MAP_MAX_ENTRIES);
21
22 return NULL;
23 }
24
after(void * arg)25 static void after(void *arg)
26 {
27 ARG_UNUSED(arg);
28
29 (void)sys_hashmap_clear(&map, NULL, NULL);
30 (void)sys_hashmap_clear(&custom_load_factor_map, NULL, NULL);
31 }
32
33 ZTEST_SUITE(hash_map, NULL, setup, NULL, after, NULL);
34