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 
ZTEST(settings_config,test_config_commit)10 ZTEST(settings_config, test_config_commit)
11 {
12 	char name[80];
13 	int rc;
14 
15 	strcpy(name, "bar");
16 	rc = settings_runtime_commit(name);
17 	zassert_true(rc, "commit-nonexisting-tree call should succeed");
18 	zassert_true(ctest_get_call_state() == 0,
19 		     "a handler was called unexpectedly");
20 
21 	rc = settings_commit();
22 	zassert_true(rc == 0, "commit-All call should succeed");
23 	zassert_true(test_commit_called == 1,
24 		     "the COMMIT handler wasn't called");
25 	ctest_clear_call_state();
26 
27 	strcpy(name, "myfoo");
28 	rc = settings_runtime_commit(name);
29 	zassert_true(rc == 0, "commit-a-tree call should succeed");
30 	zassert_true(test_commit_called == 1,
31 		     "the COMMIT handler wasn't called");
32 	ctest_clear_call_state();
33 }
34