@@ -33,7 +33,7 @@ SCENARIO("A callback is registered via 'onUpdate' to be called on property chang
3333
3434 GIVEN (" CloudProtocol::V1" )
3535 {
36- ArduinoCloudThing thing (CloudProtocol::V1) ;
36+ ArduinoCloudThing thing;
3737 thing.begin ();
3838
3939 int test = 10 ;
@@ -48,7 +48,7 @@ SCENARIO("A callback is registered via 'onUpdate' to be called on property chang
4848 }
4949 GIVEN (" CloudProtocol::V2" )
5050 {
51- ArduinoCloudThing thing (CloudProtocol::V2) ;
51+ ArduinoCloudThing thing;
5252 thing.begin ();
5353
5454 int test = 10 ;
@@ -78,16 +78,16 @@ void switch_callback()
7878
7979SCENARIO (" A (boolean) property is manipulated in the callback to its origin state" , " [ArduinoCloudThing::decode]" )
8080{
81- GIVEN (" CloudProtocol::V1 " )
81+ GIVEN (" CloudProtocol::V2 " )
8282 {
83- ArduinoCloudThing thing (CloudProtocol::V1) ;
83+ ArduinoCloudThing thing;
8484 thing.begin ();
8585 encode (thing);
8686
8787 thing.addPropertyReal (switch_turned_on, " switch_turned_on" , Permission::ReadWrite).onUpdate (switch_callback);
8888
89- /* [{"n" : "switch_turned_on", "vb" : true}] = 81 A2 61 6E 70 73 77 69 74 63 68 5F 74 75 72 6E 65 64 5F 6F 6E 62 76 62 F5 */
90- uint8_t const payload[] = {0x81 , 0xA2 , 0x61 , 0x6E , 0x70 , 0x73 , 0x77 , 0x69 , 0x74 , 0x63 , 0x68 , 0x5F , 0x74 , 0x75 , 0x72 , 0x6E , 0x65 , 0x64 , 0x5F , 0x6F , 0x6E , 0x62 , 0x76 , 0x62 , 0xF5 };
89+ /* [{0 : "switch_turned_on", 4 : true}] = 81 A2 00 70 73 77 69 74 63 68 5F 74 75 72 6E 65 64 5F 6F 6E 04 F5 */
90+ uint8_t const payload[] = {0x81 , 0xA2 , 0x00 , 0x70 , 0x73 , 0x77 , 0x69 , 0x74 , 0x63 , 0x68 , 0x5F , 0x74 , 0x75 , 0x72 , 0x6E , 0x65 , 0x64 , 0x5F , 0x6F , 0x6E , 0x04 , 0xF5 };
9191 int const payload_length = sizeof (payload)/sizeof (uint8_t );
9292 thing.decode (payload, payload_length);
9393
@@ -98,8 +98,8 @@ SCENARIO("A (boolean) property is manipulated in the callback to its origin stat
9898 * the cloud.
9999 */
100100
101- /* [{"n" : "switch_turned_on", "vb" : false}] = 81 BF 61 6E 70 73 77 69 74 63 68 5F 74 75 72 6E 65 64 5F 6F 6E 62 76 62 F4 FF */
102- std::vector<uint8_t > const expected = {0x81 , 0xBF , 0x61 , 0x6E , 0x70 , 0x73 , 0x77 , 0x69 , 0x74 , 0x63 , 0x68 , 0x5F , 0x74 , 0x75 , 0x72 , 0x6E , 0x65 , 0x64 , 0x5F , 0x6F , 0x6E , 0x62 , 0x76 , 0x62 , 0xF4 , 0xFF };
101+ /* [{0 : "switch_turned_on", 4 : false}] = 81 BF 00 70 73 77 69 74 63 68 5F 74 75 72 6E 65 64 5F 6F 6E 04 F4 FF */
102+ std::vector<uint8_t > const expected = {0x81 , 0xBF , 0x00 , 0x70 , 0x73 , 0x77 , 0x69 , 0x74 , 0x63 , 0x68 , 0x5F , 0x74 , 0x75 , 0x72 , 0x6E , 0x65 , 0x64 , 0x5F , 0x6F , 0x6E , 0x04 , 0xF4 , 0xFF };
103103 std::vector<uint8_t > const actual = encode (thing);
104104 REQUIRE (actual == expected);
105105 }
0 commit comments