File tree Expand file tree Collapse file tree 5 files changed +93
-0
lines changed
tests/subsys/fs/bm_zms_unity Expand file tree Collapse file tree 5 files changed +93
-0
lines changed Original file line number Diff line number Diff line change 2727#define NRFX_CRITICAL_SECTION_EXIT (...)
2828#endif
2929
30+ #if CONFIG_UNITY
31+ #define __ALIGN (x ) __aligned(x)
32+ #endif
33+
3034LOG_MODULE_REGISTER (bm_zms , CONFIG_BM_ZMS_LOG_LEVEL );
3135
3236static zms_op_t cur_op ; /* Current bm_zms operation. */
Original file line number Diff line number Diff line change 1+ #
2+ # Copyright (c) 2025 Nordic Semiconductor ASA
3+ #
4+ # SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5+ #
6+
7+ cmake_minimum_required (VERSION 3.20.0)
8+
9+ find_package (Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE} )
10+
11+ project (bm_zms_unity)
12+
13+ target_include_directories (app PRIVATE ${ZEPHYR_NRF_BM_MODULE_DIR} /include )
14+
15+ target_compile_definitions (app PRIVATE
16+ CONFIG_BM_ZMS_MAX_USERS=8
17+ CONFIG_BM_ZMS_OP_QUEUE_SIZE=16
18+ )
19+
20+ # Generate and add test file
21+ test_runner_generate(src/unity_test.c)
22+ target_sources (app PRIVATE src/unity_test.c)
23+
24+ # Unit under test
25+ target_sources (app PRIVATE ${ZEPHYR_NRF_BM_MODULE_DIR} /subsys/fs/bm_zms/bm_zms.c)
Original file line number Diff line number Diff line change 1+ #
2+ # Copyright (c) 2025 Nordic Semiconductor ASA
3+ #
4+ # SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5+ #
6+ CONFIG_UNITY=y
Original file line number Diff line number Diff line change 1+ /*
2+ * Copyright (c) 2025 Nordic Semiconductor ASA
3+ *
4+ * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5+ */
6+ #include <unity.h>
7+ #include <errno.h>
8+
9+ #include <bm/fs/bm_zms.h>
10+
11+ void bm_zms_callback (bm_zms_evt_t const * p_evt )
12+ {
13+ }
14+
15+ void test_bm_zms_register_einval (void )
16+ {
17+ int err ;
18+
19+ struct bm_zms_fs fs = { 0 };
20+
21+ err = bm_zms_register (NULL , NULL );
22+ TEST_ASSERT_EQUAL (- EINVAL , err );
23+
24+ err = bm_zms_register (& fs , NULL );
25+ TEST_ASSERT_EQUAL (- EINVAL , err );
26+
27+ err = bm_zms_register (NULL , bm_zms_callback );
28+ TEST_ASSERT_EQUAL (- EINVAL , err );
29+ }
30+
31+ void test_bm_zms_register (void )
32+ {
33+ int err ;
34+
35+ struct bm_zms_fs fs = { 0 };
36+
37+ err = bm_zms_register (& fs , bm_zms_callback );
38+ TEST_ASSERT_EQUAL (0 , err );
39+ }
40+
41+ void setUp (void )
42+ {
43+ }
44+
45+ void tearDown (void )
46+ {
47+ }
48+
49+ extern int unity_main (void );
50+
51+ int main (void )
52+ {
53+ return unity_main ();
54+ }
Original file line number Diff line number Diff line change 1+ tests :
2+ lib.bm_zms_unity :
3+ platform_allow : native_sim
4+ tags : unittest
You can’t perform that action at this time.
0 commit comments