Skip to content

Commit b203d2a

Browse files
silabs-aydoganerzr
authored andcommitted
uic: zpc: Pull request #2932: UIC-3604: Add unit test for zpc_stdin module
Merge in UIC/uic from test/UIC-3604-zpc_stdin-module-unit-test to develop (cherry picked from commit f48863b5d7fa7ded31fb2954a9307aab5a355a49) Forwarded: #11 Signed-off-by: Philippe Coval <philippe.coval@silabs.com>
1 parent d859905 commit b203d2a

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed

applications/zpc/components/zpc_stdin/test/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ target_add_unittest(
1515
zwave_tx_mock
1616
zwave_unid_mock
1717
zwave_tx_groups_mock
18+
zwave_api_mock
1819
zwave_s2_mock)
1920

2021
# Test with the real attribute store

applications/zpc/components/zpc_stdin/test/zpc_stdin_test.c

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@
2929
#include "zwave_command_handler_mock.h"
3030
#include "zwave_tx_mock.h"
3131
#include "zwave_tx_scheme_selector_mock.h"
32-
#include "zwave_utils.h"
32+
#include "zwave_utils_mock.h"
33+
#include "zwapi_protocol_controller_mock.h"
3334
#include "zwave_unid_mock.h"
3435
#include "zwave_command_class_supervision_mock.h"
3536
#include "zpc_attribute_store_network_helper_mock.h"
@@ -329,6 +330,27 @@ void test_handle_cc_versions_log()
329330
uic_stdin_handle_command("zwave_cc_versions_log"));
330331
}
331332

333+
void test_handle_nls()
334+
{
335+
sl_status_t state;
336+
uint8_t nls_state = false;
337+
338+
state = uic_stdin_handle_command("zwave_enable_nls");
339+
TEST_ASSERT_EQUAL(SL_STATUS_FAIL, state);
340+
341+
zwave_store_nls_state_ExpectAndReturn(2, true, DESIRED_ATTRIBUTE, SL_STATUS_OK);
342+
state = uic_stdin_handle_command("zwave_enable_nls 2");
343+
TEST_ASSERT_EQUAL(SL_STATUS_OK, state);
344+
345+
state = uic_stdin_handle_command("zwave_get_nls_state");
346+
TEST_ASSERT_EQUAL(SL_STATUS_FAIL, state);
347+
348+
zwapi_get_node_nls_ExpectAndReturn(2, &nls_state, SL_STATUS_OK);
349+
zwave_store_nls_state_ExpectAndReturn(2, nls_state, REPORTED_ATTRIBUTE, SL_STATUS_OK);
350+
state = uic_stdin_handle_command("zwave_get_nls_state 2");
351+
TEST_ASSERT_EQUAL(SL_STATUS_OK, state);
352+
}
353+
332354
void test_handle_zwave_s2_log_security_keys()
333355
{
334356
zwave_s2_log_security_keys_Expect(1);

0 commit comments

Comments
 (0)