1212#include < memory>
1313
1414#include < util/CBORTestUtil.h>
15+ #include < CborDecoder.h>
1516#include < MessageDecoder.h>
1617
1718/* *****************************************************************************
@@ -38,8 +39,8 @@ SCENARIO("Test the decoding of command messages") {
3839 0x33 , 0x39 , 0x34 , 0x63 };
3940
4041 size_t payload_length = sizeof (payload) / sizeof (uint8_t );
41- CBORMessageDecoder decoder;
42- Decoder::Status err = decoder .decode ((Message*)&command, payload, payload_length);
42+ // CBORMessageDecoder decoder;
43+ Decoder::Status err = CBORMessageDecoder .decode ((Message*)&command, payload, payload_length);
4344 const char *thingIdToMatch = " e4494d55-872a-4fd2-9646-92f87949394c" ;
4445
4546 THEN (" The decode is successful" ) {
@@ -67,8 +68,8 @@ SCENARIO("Test the decoding of command messages") {
6768 0x33 , 0x39 , 0x34 , 0x63 };
6869
6970 size_t payload_length = sizeof (payload) / sizeof (uint8_t );
70- CBORMessageDecoder decoder;
71- Decoder::Status err = decoder .decode ((Message*)&command, payload, payload_length);
71+ // CBORMessageDecoder decoder;
72+ Decoder::Status err = CBORMessageDecoder .decode ((Message*)&command, payload, payload_length);
7273 const char *thingIdToMatch = " e4494d55-872a-4fd2-9646-92f87949394c" ;
7374
7475 THEN (" The decode is successful" ) {
@@ -92,8 +93,8 @@ SCENARIO("Test the decoding of command messages") {
9293 0xDC , 0xB8 , 0x21 };
9394
9495 size_t payload_length = sizeof (payload) / sizeof (uint8_t );
95- CBORMessageDecoder decoder;
96- Decoder::Status err = decoder .decode ((Message*)&command, payload, payload_length);
96+ // CBORMessageDecoder decoder;
97+ Decoder::Status err = CBORMessageDecoder .decode ((Message*)&command, payload, payload_length);
9798
9899 THEN (" The decode is unsuccessful" ) {
99100 REQUIRE (err == Decoder::Status::Error);
@@ -113,8 +114,8 @@ SCENARIO("Test the decoding of command messages") {
113114 0xDC , 0xB8 , 0x21 };
114115
115116 size_t payload_length = sizeof (payload) / sizeof (uint8_t );
116- CBORMessageDecoder decoder;
117- Decoder::Status err = decoder .decode ((Message*)&command, payload, payload_length);
117+ // CBORMessageDecoder decoder;
118+ Decoder::Status err = CBORMessageDecoder .decode ((Message*)&command, payload, payload_length);
118119
119120 THEN (" The decode is successful" ) {
120121 REQUIRE (err == Decoder::Status::Error);
@@ -138,8 +139,8 @@ SCENARIO("Test the decoding of command messages") {
138139 0xDC , 0xB8 , 0x21 , 0x1A , 0x78 , 0xAC , 0xA1 , 0x91 };
139140
140141 size_t payload_length = sizeof (payload) / sizeof (uint8_t );
141- CBORMessageDecoder decoder;
142- Decoder::Status err = decoder .decode ((Message*)&command, payload, payload_length);
142+ // CBORMessageDecoder decoder;
143+ Decoder::Status err = CBORMessageDecoder .decode ((Message*)&command, payload, payload_length);
143144
144145 THEN (" The decode is successful" ) {
145146 REQUIRE (err == Decoder::Status::Complete);
@@ -168,8 +169,8 @@ SCENARIO("Test the decoding of command messages") {
168169 0x09 , 0x10 , 0x11 , 0x12 };
169170
170171 size_t payload_length = sizeof (payload) / sizeof (uint8_t );
171- CBORMessageDecoder decoder;
172- Decoder::Status err = decoder .decode ((Message*)&command, payload, payload_length);
172+ // CBORMessageDecoder decoder;
173+ Decoder::Status err = CBORMessageDecoder .decode ((Message*)&command, payload, payload_length);
173174
174175 THEN (" The decode is successful" ) {
175176 REQUIRE (err == Decoder::Status::Complete);
@@ -248,8 +249,8 @@ SCENARIO("Test the decoding of command messages") {
248249 0x2b , 0x09 , 0x49 , 0xbc , 0x16 , 0xdc , 0x49 };
249250
250251 size_t payload_length = sizeof (payload) / sizeof (uint8_t );
251- CBORMessageDecoder decoder;
252- Decoder::Status err = decoder .decode ((Message*)&command, payload, payload_length);
252+ // CBORMessageDecoder decoder;
253+ Decoder::Status err = CBORMessageDecoder .decode ((Message*)&command, payload, payload_length);
253254
254255 uint8_t otaIdToMatch[ID_SIZE] = { 0xC7 , 0x3C , 0xB0 , 0x45 , 0xF9 , 0xC2 , 0x43 , 0x45 ,
255256 0x85 , 0xAF , 0xFA , 0x36 , 0xA3 , 0x07 , 0xBF , 0xE7 };
@@ -387,8 +388,8 @@ SCENARIO("Test the decoding of command messages") {
387388 0x2b , 0x09 , 0x49 , 0xbc , 0x16 , 0xdc , 0x49 };
388389
389390 size_t payload_length = sizeof (payload) / sizeof (uint8_t );
390- CBORMessageDecoder decoder;
391- Decoder::Status err = decoder .decode ((Message*)&command, payload, payload_length);
391+ // CBORMessageDecoder decoder;
392+ Decoder::Status err = CBORMessageDecoder .decode ((Message*)&command, payload, payload_length);
392393
393394 THEN (" The decode is successful" ) {
394395 REQUIRE (err == Decoder::Status::Error);
@@ -451,8 +452,8 @@ SCENARIO("Test the decoding of command messages") {
451452 0x2b , 0x09 , 0x49 , 0xbc , 0x16 , 0xdc , 0x49 };
452453
453454 size_t payload_length = sizeof (payload) / sizeof (uint8_t );
454- CBORMessageDecoder decoder;
455- Decoder::Status err = decoder .decode ((Message*)&command, payload, payload_length);
455+ // CBORMessageDecoder decoder;
456+ Decoder::Status err = CBORMessageDecoder .decode ((Message*)&command, payload, payload_length);
456457
457458 THEN (" The decode is successful" ) {
458459 REQUIRE (err == Decoder::Status::Error);
@@ -510,8 +511,8 @@ SCENARIO("Test the decoding of command messages") {
510511 0xdc , 0x49 };
511512
512513 size_t payload_length = sizeof (payload) / sizeof (uint8_t );
513- CBORMessageDecoder decoder;
514- Decoder::Status err = decoder .decode ((Message*)&command, payload, payload_length);
514+ // CBORMessageDecoder decoder;
515+ Decoder::Status err = CBORMessageDecoder .decode ((Message*)&command, payload, payload_length);
515516
516517 THEN (" The decode is successful" ) {
517518 REQUIRE (err == Decoder::Status::Error);
@@ -569,8 +570,8 @@ SCENARIO("Test the decoding of command messages") {
569570 0xB8 , 0x21 };
570571
571572 size_t payload_length = sizeof (payload) / sizeof (uint8_t );
572- CBORMessageDecoder decoder;
573- Decoder::Status err = decoder .decode ((Message*)&command, payload, payload_length);
573+ // CBORMessageDecoder decoder;
574+ Decoder::Status err = CBORMessageDecoder .decode ((Message*)&command, payload, payload_length);
574575
575576 THEN (" The decode is successful" ) {
576577 REQUIRE (err == Decoder::Status::Error);
@@ -595,8 +596,8 @@ SCENARIO("Test the decoding of command messages") {
595596 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 };
596597
597598 size_t payload_length = sizeof (payload) / sizeof (uint8_t );
598- CBORMessageDecoder decoder;
599- Decoder::Status err = decoder .decode ((Message*)&command, payload, payload_length);
599+ // CBORMessageDecoder decoder;
600+ Decoder::Status err = CBORMessageDecoder .decode ((Message*)&command, payload, payload_length);
600601
601602 THEN (" The decode is unsuccessful - OtaBeginUp is not supported" ) {
602603 REQUIRE (err == Decoder::Status::Error);
@@ -618,8 +619,8 @@ SCENARIO("Test the decoding of command messages") {
618619 0x68 , 0x69 , 0x6e , 0x67 , 0x5f , 0x69 , 0x64 };
619620
620621 size_t payload_length = sizeof (payload) / sizeof (uint8_t );
621- CBORMessageDecoder decoder;
622- Decoder::Status err = decoder .decode ((Message*)&command, payload, payload_length);
622+ // CBORMessageDecoder decoder;
623+ Decoder::Status err = CBORMessageDecoder .decode ((Message*)&command, payload, payload_length);
623624
624625 THEN (" The decode is unsuccessful - ThingBeginCmd is not supported" ) {
625626 REQUIRE (err == Decoder::Status::Error);
@@ -638,8 +639,8 @@ SCENARIO("Test the decoding of command messages") {
638639 uint8_t const payload[] = {0xda , 0x00 , 0x01 , 0x05 , 0x00 , 0x80 };
639640
640641 size_t payload_length = sizeof (payload) / sizeof (uint8_t );
641- CBORMessageDecoder decoder;
642- Decoder::Status err = decoder .decode ((Message*)&command, payload, payload_length);
642+ // CBORMessageDecoder decoder;
643+ Decoder::Status err = CBORMessageDecoder .decode ((Message*)&command, payload, payload_length);
643644
644645 THEN (" The decode is unsuccessful - LastValuesBeginCmd is not supported" ) {
645646 REQUIRE (err == Decoder::Status::Error);
@@ -661,8 +662,8 @@ SCENARIO("Test the decoding of command messages") {
661662 0x2e , 0x30 , 0x2e , 0x30 };
662663
663664 size_t payload_length = sizeof (payload) / sizeof (uint8_t );
664- CBORMessageDecoder decoder;
665- Decoder::Status err = decoder .decode ((Message*)&command, payload, payload_length);
665+ // CBORMessageDecoder decoder;
666+ Decoder::Status err = CBORMessageDecoder .decode ((Message*)&command, payload, payload_length);
666667
667668 THEN (" The decode is unsuccessful - DeviceBeginCmd is not supported" ) {
668669 REQUIRE (err == Decoder::Status::Error);
@@ -689,8 +690,8 @@ SCENARIO("Test the decoding of command messages") {
689690 0x20 , 0x18 , 0x64 };
690691
691692 size_t payload_length = sizeof (payload) / sizeof (uint8_t );
692- CBORMessageDecoder decoder;
693- Decoder::Status err = decoder .decode ((Message*)&command, payload, payload_length);
693+ // CBORMessageDecoder decoder;
694+ Decoder::Status err = CBORMessageDecoder .decode ((Message*)&command, payload, payload_length);
694695
695696 THEN (" The decode is unsuccessful - OtaProgressCmdUp is not supported" ) {
696697 REQUIRE (err == Decoder::Status::Error);
@@ -709,8 +710,8 @@ SCENARIO("Test the decoding of command messages") {
709710 uint8_t const payload[] = {0xda , 0x00 , 0x01 , 0x08 , 0x00 , 0x80 };
710711
711712 size_t payload_length = sizeof (payload) / sizeof (uint8_t );
712- CBORMessageDecoder decoder;
713- Decoder::Status err = decoder .decode ((Message*)&command, payload, payload_length);
713+ // CBORMessageDecoder decoder;
714+ Decoder::Status err = CBORMessageDecoder .decode ((Message*)&command, payload, payload_length);
714715
715716 THEN (" The decode is unsuccessful - TimezoneCommandUp is not supported" ) {
716717 REQUIRE (err == Decoder::Status::Error);
@@ -734,8 +735,8 @@ SCENARIO("Test the decoding of command messages") {
734735 0xDC , 0xB8 , 0x21 , 0x1A , 0x78 , 0xAC , 0xA1 , 0x91 };
735736
736737 size_t payload_length = sizeof (payload) / sizeof (uint8_t );
737- CBORMessageDecoder decoder;
738- Decoder::Status err = decoder .decode ((Message*)&command, payload, payload_length);
738+ // CBORMessageDecoder decoder;
739+ Decoder::Status err = CBORMessageDecoder .decode ((Message*)&command, payload, payload_length);
739740
740741 THEN (" The decode is unsuccessful" ) {
741742 REQUIRE (err == Decoder::Status::Error);
@@ -758,8 +759,8 @@ SCENARIO("Test the decoding of command messages") {
758759 0xAC , 0xA1 , 0x91 };
759760
760761 size_t payload_length = sizeof (payload) / sizeof (uint8_t );
761- CBORMessageDecoder decoder;
762- Decoder::Status err = decoder .decode ((Message*)&command, payload, payload_length);
762+ // CBORMessageDecoder decoder;
763+ Decoder::Status err = CBORMessageDecoder .decode ((Message*)&command, payload, payload_length);
763764
764765 THEN (" The decode is unsuccessful" ) {
765766 REQUIRE (err == Decoder::Status::Error);
@@ -775,8 +776,8 @@ SCENARIO("Test the decoding of command messages") {
775776 uint8_t const payload[] = {0xFF };
776777
777778 size_t payload_length = sizeof (payload) / sizeof (uint8_t );
778- CBORMessageDecoder decoder;
779- Decoder::Status err = decoder .decode ((Message*)&command, payload, payload_length);
779+ // CBORMessageDecoder decoder;
780+ Decoder::Status err = CBORMessageDecoder .decode ((Message*)&command, payload, payload_length);
780781
781782 THEN (" The decode is unsuccessful" ) {
782783 REQUIRE (err == Decoder::Status::Error);
0 commit comments