Skip to content

Commit 30bf152

Browse files
silabs-aydoganerzr
authored andcommitted
uic: zpc: Pull request #2930: UIC-3601: Add unit test for zwave_command_handler module
Merge in UIC/uic from test/UIC-3601-zwave_command_handler-unit-test to develop (cherry picked from commit fe8823d7337c244b4ab8903402b6668f30b8d608) Forwarded: #11 Signed-off-by: Philippe Coval <philippe.coval@silabs.com>
1 parent ab74c0b commit 30bf152

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

applications/zpc/components/zwave_command_handler/test/zwave_command_handler_test.c

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,14 +141,14 @@ void zwave_command_handler_init_test_helper()
141141
TEST_ASSERT_EQUAL_UINT8(1, cc_version_init_counter);
142142
}
143143

144-
void test_on_frame_received_supported_cc()
144+
void test_on_application_frame_received_supported_cc()
145145
{
146146
zwave_command_handler_init_test_helper();
147147
zwave_security_validation_is_security_valid_for_support_ExpectAndReturn(
148148
ZWAVE_CONTROLLER_ENCAPSULATION_NONE,
149149
&connection_info_frame_non_secure,
150150
true);
151-
// Receive a frame
151+
// Receive an application frame
152152
zwave_controller_callbacks->on_application_frame_received(
153153
&connection_info_frame_non_secure,
154154
NULL,
@@ -158,6 +158,22 @@ void test_on_frame_received_supported_cc()
158158
TEST_ASSERT_EQUAL_UINT8(1, cc_zwave_plus_handle_counter);
159159
}
160160

161+
void test_on_protocol_frame_received_supported_cc()
162+
{
163+
zwave_command_handler_init_test_helper();
164+
zwave_controller_get_key_from_encapsulation_ExpectAndReturn(
165+
ZWAVE_CONTROLLER_ENCAPSULATION_SECURITY_2_AUTHENTICATED,
166+
ZWAVE_CONTROLLER_S2_AUTHENTICATED_KEY);
167+
// Receive a protocol frame
168+
zwave_controller_callbacks->on_protocol_frame_received(
169+
&connection_info_frame_security_2_authenticated,
170+
NULL,
171+
frame_data_1,
172+
sizeof(frame_data_1));
173+
174+
TEST_ASSERT_EQUAL_UINT8(0, cc_zwave_plus_handle_counter);
175+
}
176+
161177
void test_security_levels()
162178
{
163179
zwave_command_handler_init_test_helper();

0 commit comments

Comments
 (0)