zephyr/tests/subsys/settings/src/settings_test_commit.c
Meng xianglin 96484695e7 tests: settings: move to new ztest API
test cases in tests/subsys/settings/fcb, tests/subsys/settings/littlefs,
tests/subsys/setttings/nvs all depend on tests/subsys/settings/src and
tests/subsys/settings/fs, so update them in one commit.

Signed-off-by: Meng xianglin <xianglinx.meng@intel.com>
2022-08-26 11:56:51 +02:00

34 lines
872 B
C

/*
* Copyright (c) 2018 Nordic Semiconductor ASA
* Copyright (c) 2015 Runtime Inc
*
* SPDX-License-Identifier: Apache-2.0
*/
#include "settings_test.h"
ZTEST(settings_config, test_config_commit)
{
char name[80];
int rc;
strcpy(name, "bar");
rc = settings_runtime_commit(name);
zassert_true(rc, "commit-nonexisting-tree call should succeed");
zassert_true(ctest_get_call_state() == 0,
"a handler was called unexpectedly");
rc = settings_commit();
zassert_true(rc == 0, "commit-All call should succeed");
zassert_true(test_commit_called == 1,
"the COMMIT handler wasn't called");
ctest_clear_call_state();
strcpy(name, "myfoo");
rc = settings_runtime_commit(name);
zassert_true(rc == 0, "commit-a-tree call should succeed");
zassert_true(test_commit_called == 1,
"the COMMIT handler wasn't called");
ctest_clear_call_state();
}