1 /*
2  * Copyright (c) 2018 Nordic Semiconductor ASA
3  * Copyright (c) 2015 Runtime Inc
4  *
5  * SPDX-License-Identifier: Apache-2.0
6  */
7 
8 #include "settings_test.h"
9 
test_config_insert_x(int idx)10 void test_config_insert_x(int idx)
11 {
12 	int rc;
13 
14 	rc = settings_register(&c_test_handlers[idx]);
15 	zassert_true(rc == 0, "settings_register fail");
16 }
17 
settings_unregister(struct settings_handler * handler)18 int settings_unregister(struct settings_handler *handler)
19 {
20 	extern sys_slist_t settings_handlers;
21 
22 	return sys_slist_find_and_remove(&settings_handlers, &handler->node);
23 }
24 
test_config_insert2(void)25 void test_config_insert2(void)
26 {
27 	test_config_insert_x(1);
28 }
29 
test_config_insert3(void)30 void test_config_insert3(void)
31 {
32 	test_config_insert_x(2);
33 }
34 
settings_config_setup(void)35 void *settings_config_setup(void)
36 {
37 	int rc;
38 
39 	rc = settings_register(&c_test_handlers[0]);
40 	zassume_true(rc == 0, "settings_register fail");
41 	return NULL;
42 }
43 
settings_config_teardown(void * fixture)44 void settings_config_teardown(void *fixture)
45 {
46 
47 	settings_unregister(&c_test_handlers[0]);
48 }
49