Skip to content

Commit e9edccd

Browse files
fixup! Unit testing adding missing test cases for failing decode
1 parent caeeeec commit e9edccd

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

Diff for: extras/test/src/test_command_decode.cpp

+23
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,29 @@ SCENARIO("Test the decoding of command messages") {
308308
free(command.lastValuesUpdateCmd.params.last_values);
309309
}
310310

311+
WHEN("Decode the LastValuesUpdateCmd message, but lastvalues is an integer")
312+
{
313+
CommandDown command;
314+
315+
/*
316+
DA 00010600 # tag(67072)
317+
81 # array(1)
318+
1A 65DCB821 # unsigned(1708963873)
319+
320+
*/
321+
322+
uint8_t const payload[] = {0xDA, 0x00, 0x01, 0x06, 0x00, 0x81, 0x1A, 0x65,
323+
0xDC, 0xB8, 0x21};
324+
325+
size_t payload_length = sizeof(payload) / sizeof(uint8_t);
326+
CBORMessageDecoder decoder;
327+
MessageDecoder::Status err = decoder.decode((Message*)&command, payload, payload_length);
328+
329+
THEN("The decode is unsuccessful") {
330+
REQUIRE(err == MessageDecoder::Status::Error);
331+
}
332+
}
333+
311334
/****************************************************************************/
312335

313336
WHEN("Decode the OtaUpdateCmdDown message")

0 commit comments

Comments
 (0)