12
12
#include < memory>
13
13
14
14
#include < util/CBORTestUtil.h>
15
+ #include < CborDecoder.h>
15
16
#include < MessageDecoder.h>
16
17
17
18
/* *****************************************************************************
@@ -38,8 +39,8 @@ SCENARIO("Test the decoding of command messages") {
38
39
0x33 , 0x39 , 0x34 , 0x63 };
39
40
40
41
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);
43
44
const char *thingIdToMatch = " e4494d55-872a-4fd2-9646-92f87949394c" ;
44
45
45
46
THEN (" The decode is successful" ) {
@@ -67,8 +68,8 @@ SCENARIO("Test the decoding of command messages") {
67
68
0x33 , 0x39 , 0x34 , 0x63 };
68
69
69
70
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);
72
73
const char *thingIdToMatch = " e4494d55-872a-4fd2-9646-92f87949394c" ;
73
74
74
75
THEN (" The decode is successful" ) {
@@ -92,8 +93,8 @@ SCENARIO("Test the decoding of command messages") {
92
93
0xDC , 0xB8 , 0x21 };
93
94
94
95
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);
97
98
98
99
THEN (" The decode is unsuccessful" ) {
99
100
REQUIRE (err == Decoder::Status::Error);
@@ -113,8 +114,8 @@ SCENARIO("Test the decoding of command messages") {
113
114
0xDC , 0xB8 , 0x21 };
114
115
115
116
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);
118
119
119
120
THEN (" The decode is successful" ) {
120
121
REQUIRE (err == Decoder::Status::Error);
@@ -138,8 +139,8 @@ SCENARIO("Test the decoding of command messages") {
138
139
0xDC , 0xB8 , 0x21 , 0x1A , 0x78 , 0xAC , 0xA1 , 0x91 };
139
140
140
141
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);
143
144
144
145
THEN (" The decode is successful" ) {
145
146
REQUIRE (err == Decoder::Status::Complete);
@@ -168,8 +169,8 @@ SCENARIO("Test the decoding of command messages") {
168
169
0x09 , 0x10 , 0x11 , 0x12 };
169
170
170
171
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);
173
174
174
175
THEN (" The decode is successful" ) {
175
176
REQUIRE (err == Decoder::Status::Complete);
@@ -248,8 +249,8 @@ SCENARIO("Test the decoding of command messages") {
248
249
0x2b , 0x09 , 0x49 , 0xbc , 0x16 , 0xdc , 0x49 };
249
250
250
251
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);
253
254
254
255
uint8_t otaIdToMatch[ID_SIZE] = { 0xC7 , 0x3C , 0xB0 , 0x45 , 0xF9 , 0xC2 , 0x43 , 0x45 ,
255
256
0x85 , 0xAF , 0xFA , 0x36 , 0xA3 , 0x07 , 0xBF , 0xE7 };
@@ -387,8 +388,8 @@ SCENARIO("Test the decoding of command messages") {
387
388
0x2b , 0x09 , 0x49 , 0xbc , 0x16 , 0xdc , 0x49 };
388
389
389
390
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);
392
393
393
394
THEN (" The decode is successful" ) {
394
395
REQUIRE (err == Decoder::Status::Error);
@@ -451,8 +452,8 @@ SCENARIO("Test the decoding of command messages") {
451
452
0x2b , 0x09 , 0x49 , 0xbc , 0x16 , 0xdc , 0x49 };
452
453
453
454
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);
456
457
457
458
THEN (" The decode is successful" ) {
458
459
REQUIRE (err == Decoder::Status::Error);
@@ -510,8 +511,8 @@ SCENARIO("Test the decoding of command messages") {
510
511
0xdc , 0x49 };
511
512
512
513
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);
515
516
516
517
THEN (" The decode is successful" ) {
517
518
REQUIRE (err == Decoder::Status::Error);
@@ -569,8 +570,8 @@ SCENARIO("Test the decoding of command messages") {
569
570
0xB8 , 0x21 };
570
571
571
572
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);
574
575
575
576
THEN (" The decode is successful" ) {
576
577
REQUIRE (err == Decoder::Status::Error);
@@ -595,8 +596,8 @@ SCENARIO("Test the decoding of command messages") {
595
596
0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 };
596
597
597
598
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);
600
601
601
602
THEN (" The decode is unsuccessful - OtaBeginUp is not supported" ) {
602
603
REQUIRE (err == Decoder::Status::Error);
@@ -618,8 +619,8 @@ SCENARIO("Test the decoding of command messages") {
618
619
0x68 , 0x69 , 0x6e , 0x67 , 0x5f , 0x69 , 0x64 };
619
620
620
621
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);
623
624
624
625
THEN (" The decode is unsuccessful - ThingBeginCmd is not supported" ) {
625
626
REQUIRE (err == Decoder::Status::Error);
@@ -638,8 +639,8 @@ SCENARIO("Test the decoding of command messages") {
638
639
uint8_t const payload[] = {0xda , 0x00 , 0x01 , 0x05 , 0x00 , 0x80 };
639
640
640
641
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);
643
644
644
645
THEN (" The decode is unsuccessful - LastValuesBeginCmd is not supported" ) {
645
646
REQUIRE (err == Decoder::Status::Error);
@@ -661,8 +662,8 @@ SCENARIO("Test the decoding of command messages") {
661
662
0x2e , 0x30 , 0x2e , 0x30 };
662
663
663
664
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);
666
667
667
668
THEN (" The decode is unsuccessful - DeviceBeginCmd is not supported" ) {
668
669
REQUIRE (err == Decoder::Status::Error);
@@ -689,8 +690,8 @@ SCENARIO("Test the decoding of command messages") {
689
690
0x20 , 0x18 , 0x64 };
690
691
691
692
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);
694
695
695
696
THEN (" The decode is unsuccessful - OtaProgressCmdUp is not supported" ) {
696
697
REQUIRE (err == Decoder::Status::Error);
@@ -709,8 +710,8 @@ SCENARIO("Test the decoding of command messages") {
709
710
uint8_t const payload[] = {0xda , 0x00 , 0x01 , 0x08 , 0x00 , 0x80 };
710
711
711
712
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);
714
715
715
716
THEN (" The decode is unsuccessful - TimezoneCommandUp is not supported" ) {
716
717
REQUIRE (err == Decoder::Status::Error);
@@ -734,8 +735,8 @@ SCENARIO("Test the decoding of command messages") {
734
735
0xDC , 0xB8 , 0x21 , 0x1A , 0x78 , 0xAC , 0xA1 , 0x91 };
735
736
736
737
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);
739
740
740
741
THEN (" The decode is unsuccessful" ) {
741
742
REQUIRE (err == Decoder::Status::Error);
@@ -758,8 +759,8 @@ SCENARIO("Test the decoding of command messages") {
758
759
0xAC , 0xA1 , 0x91 };
759
760
760
761
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);
763
764
764
765
THEN (" The decode is unsuccessful" ) {
765
766
REQUIRE (err == Decoder::Status::Error);
@@ -775,8 +776,8 @@ SCENARIO("Test the decoding of command messages") {
775
776
uint8_t const payload[] = {0xFF };
776
777
777
778
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);
780
781
781
782
THEN (" The decode is unsuccessful" ) {
782
783
REQUIRE (err == Decoder::Status::Error);
0 commit comments