Skip to content

Commit 41b4cad

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

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

extras/test/src/test_command_decode.cpp

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -667,6 +667,42 @@ 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, 0x63,
690+
0x34, 0x39, 0x58, 0x20, 0xdf, 0x1e, 0xac, 0x9c,
691+
0x7b, 0xd6, 0x34, 0x73, 0xff, 0xfb, 0x11, 0x7f,
692+
0x98, 0x73, 0x70, 0x3e, 0x4e, 0xc9, 0x55, 0x93,
693+
0x1e, 0x26, 0x7f, 0x26, 0x26, 0x2b, 0x09, 0x49,
694+
0xbc, 0x16, 0xdc, 0x49, 0x1A, 0x65, 0xDC, 0xB8,
695+
0x21};
696+
697+
size_t payload_length = sizeof(payload) / sizeof(uint8_t);
698+
CBORMessageDecoder decoder;
699+
MessageDecoder::Status err = decoder.decode((Message*)&command, payload, payload_length);
700+
701+
THEN("The decode is successful") {
702+
REQUIRE(err == MessageDecoder::Status::Error);
703+
}
704+
}
705+
670706
/****************************************************************************/
671707

672708
WHEN("Decode the OtaBeginUp message")

0 commit comments

Comments
 (0)