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_getset_int)10 ZTEST(settings_config, test_config_getset_int)
11 {
12 char name[80];
13 char tmp[64];
14 int rc;
15 uint8_t small_value;
16
17 small_value = 42U;
18 strcpy(name, "myfoo/mybar");
19 rc = settings_runtime_set(name, &small_value, sizeof(small_value));
20 zassert_true(rc == 0, "can not set key value");
21 zassert_true(test_set_called == 1, "the SET handler wasn't called");
22 zassert_true(val8 == 42,
23 "SET handler: was called with wrong parameters");
24 ctest_clear_call_state();
25
26 strcpy(name, "myfoo/mybar");
27 rc = settings_runtime_get(name, tmp, sizeof(tmp));
28 zassert_true(rc == 1, "the key value should been available");
29 zassert_true(test_get_called == 1, "the GET handler wasn't called");
30 zassert_equal(42, tmp[0], "unexpected value fetched");
31 ctest_clear_call_state();
32 }
33