Skip to content

Commit 5e81c48

Browse files
added unit test for OtaUpdateCmdDown message decode without field url
1 parent 8404c21 commit 5e81c48

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

extras/test/src/test_command_decode.cpp

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -667,6 +667,36 @@ SCENARIO("Test the decoding of command messages") {
667667
}
668668
}
669669

670+
/****************************************************************************/
671+
672+
WHEN("Decode the OtaUpdateCmdDown message without field url")
673+
{
674+
CommandDown command;
675+
676+
/*
677+
DA 00010100 # tag(65792)
678+
84 # array(4)
679+
50 # bytes(16)
680+
C73CB045F9C2434585AFFA36A307BFE7"\xC7<\xB0E\xF9\xC2CE\x85\xAF\xFA6\xA3\a\xBF\xE7"
681+
58 20 # bytes(32)
682+
DF1EAC9C7BD63473FFFB117F9873703E
683+
4EC955931E267F26262B0949BC16DC49# "\xDF\u001E\xAC\x9C{\xD64s\xFF\xFB\u0011\u007F\x98sp>N\xC9U\x93\u001E&\u007F&&+\tI\xBC\u0016\xDCI"
684+
1A 65DCB821 # unsigned(1708963873)
685+
686+
*/
687+
uint8_t const payload[] = {0xda, 0x00, 0x01, 0x01, 0x00, 0x84, 0x50, 0xc7,
688+
0x3c, 0xb0, 0x45, 0xf9, 0xc2, 0x43, 0x45, 0x85,
689+
0xaf, 0xfa, 0x36, 0xa3, 0x07, 0xbf, 0xe7};
690+
691+
size_t payload_length = sizeof(payload) / sizeof(uint8_t);
692+
CBORMessageDecoder decoder;
693+
MessageDecoder::Status err = decoder.decode((Message*)&command, payload, payload_length);
694+
695+
THEN("The decode is successful") {
696+
REQUIRE(err == MessageDecoder::Status::Error);
697+
}
698+
}
699+
670700
/****************************************************************************/
671701

672702
WHEN("Decode the OtaBeginUp message")

0 commit comments

Comments
 (0)