12
12
*****************************************************************************/
13
13
#include "unity.h"
14
14
#include "zwave_controller_transport.h"
15
+ #include "zwave_controller_transport_internal.h"
15
16
#include "zwave_controller_transport_test_callbacks_mock.h"
16
17
#include "zwave_controller_internal.h"
17
18
#include "zwave_tx_mock.h"
@@ -216,4 +217,29 @@ void test_encapsulation_cc_versions_test()
216
217
TEST_ASSERT_EQUAL (
217
218
t12 .version ,
218
219
zwave_controller_transport_is_encapsulation_cc (t12 .command_class ));
219
- }
220
+ }
221
+
222
+ void test_zwave_controller_transport_empty_frame_test ()
223
+ {
224
+ zwave_controller_connection_info_t conn = {};
225
+ zwave_rx_receive_options_t opt = {};
226
+
227
+ // Test with a NULL frame_data pointer
228
+ TEST_ASSERT_EQUAL (
229
+ SL_STATUS_INVALID_PARAMETER ,
230
+ zwave_controller_transport_on_frame_received (& conn , & opt , NULL , 0 ));
231
+
232
+ // Test with frame_length set to 0
233
+ const uint8_t empty_frame [] = {};
234
+ TEST_ASSERT_EQUAL (
235
+ SL_STATUS_INVALID_PARAMETER ,
236
+ zwave_controller_transport_on_frame_received (& conn , & opt , empty_frame , 0 ));
237
+
238
+ // Test with frame_length less than 1
239
+ const uint8_t invalid_frame [] = {0x01 };
240
+ TEST_ASSERT_EQUAL (SL_STATUS_INVALID_PARAMETER ,
241
+ zwave_controller_transport_on_frame_received (& conn ,
242
+ & opt ,
243
+ invalid_frame ,
244
+ 0 ));
245
+ }
0 commit comments