Skip to content

Commit 1563598

Browse files
committed
Add test decode invalid cbor message
1 parent 9f67be4 commit 1563598

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

extras/test/src/test_command_decode.cpp

+17
Original file line numberDiff line numberDiff line change
@@ -709,4 +709,21 @@ SCENARIO("Test the decoding of command messages") {
709709
}
710710
}
711711

712+
/****************************************************************************/
713+
714+
WHEN("Decode an invalid CBOR message")
715+
{
716+
CommandDown command;
717+
718+
uint8_t const payload[] = {0xFF};
719+
720+
size_t payload_length = sizeof(payload) / sizeof(uint8_t);
721+
CBORMessageDecoder decoder;
722+
Decoder::Status err = decoder.decode((Message*)&command, payload, payload_length);
723+
724+
THEN("The decode is unsuccessful") {
725+
REQUIRE(err == Decoder::Status::Error);
726+
}
727+
}
728+
712729
}

0 commit comments

Comments
 (0)