Skip to content

Commit 9dba1b2

Browse files
committed
Add decode test for CloudTime type
1 parent dae7cd5 commit 9dba1b2

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

extras/test/src/test_decode.cpp

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -382,6 +382,24 @@ SCENARIO("Arduino Cloud Properties are decoded", "[ArduinoCloudThing::decode]")
382382

383383
/************************************************************************************/
384384

385+
WHEN("A Time property is changed via CBOR message")
386+
{
387+
PropertyContainer property_container;
388+
389+
CloudTime test;
390+
test = 0;
391+
addPropertyToContainer(property_container, test, "test", Permission::ReadWrite);
392+
393+
/* [{0: "test", 2: 4294967295}] = 81 A2 00 64 74 65 73 74 02 1A FF FF FF FF */
394+
uint8_t const payload[] = {0x81, 0xA2, 0x00, 0x64, 0x74, 0x65, 0x73, 0x74, 0x02, 0x1A, 0xFF, 0xFF, 0xFF, 0xFF};
395+
int const payload_length = sizeof(payload) / sizeof(uint8_t);
396+
CBORDecoder::decode(property_container, payload, payload_length);
397+
398+
REQUIRE(test == 4294967295);
399+
}
400+
401+
/************************************************************************************/
402+
385403
WHEN("Multiple properties is changed via CBOR message")
386404
{
387405
WHEN("Multiple properties of different type are changed via CBOR message")

0 commit comments

Comments
 (0)