1 /* SPDX-License-Identifier: Apache-2.0 */
2 /* Copyright (c) 2022 Nordic semiconductor ASA */
3 
4 #include <zephyr/kernel.h>
5 #include <zephyr/ztest.h>
6 #include <errno.h>
7 #include <zephyr/settings/settings.h>
8 #include <zephyr/fs/nvs.h>
9 
ZTEST(settings_functional,test_setting_storage_get)10 ZTEST(settings_functional, test_setting_storage_get)
11 {
12 	int rc;
13 	void *storage;
14 	uint16_t data = 0x5a5a;
15 	ssize_t nvs_rc;
16 
17 	rc = settings_storage_get(&storage);
18 	zassert_equal(0, rc, "Can't fetch storage reference (err=%d)", rc);
19 
20 	zassert_not_null(storage, "Null reference.");
21 
22 	nvs_rc = nvs_write((struct nvs_fs *)storage, 26, &data, sizeof(data));
23 
24 	zassert_true(nvs_rc >= 0, "Can't read nvs record (err=%d).", rc);
25 }
26 ZTEST_SUITE(settings_functional, NULL, NULL, NULL, NULL, NULL);
27