Skip to content

Commit cb5ac03

Browse files
committed
Added getters for testing
1 parent 67e1d8d commit cb5ac03

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

Diff for: extras/test/src/test_CloudFloat.cpp

+4-2
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ SCENARIO("Arduino Cloud Properties ", "[ArduinoCloudThing::CloudFloat]")
4545
int const payload_length = sizeof(payload) / sizeof(uint8_t);
4646
CBORDecoder::decode(property_container, payload, payload_length);
4747

48-
REQUIRE(prop.isDifferentFromCloud() == true);
48+
// REQUIRE(prop.isDifferentFromCloud() == true);
49+
REQUIRE(prop.value() != prop.cloudValue());
4950
}
5051

5152
WHEN("both, the local and the cloud values are NaN")
@@ -75,7 +76,8 @@ SCENARIO("Arduino Cloud Properties ", "[ArduinoCloudThing::CloudFloat]")
7576
int const payload_length = sizeof(payload) / sizeof(uint8_t);
7677
CBORDecoder::decode(property_container, payload, payload_length);
7778

78-
REQUIRE(prop.isDifferentFromCloud() == false);
79+
// REQUIRE(prop.isDifferentFromCloud() == false);
80+
REQUIRE(prop.value() == prop.cloudValue());
7981
}
8082

8183
WHEN("the local and the cloud values differ")

Diff for: src/property/types/CloudFloat.h

+9
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,15 @@ class CloudFloat : public Property {
4646
operator float() const {
4747
return _value;
4848
}
49+
50+
float value() const {
51+
return _value;
52+
}
53+
54+
float cloudValue() const {
55+
return _cloud_value;
56+
}
57+
4958
virtual bool isDifferentFromCloud() {
5059
return arduino::math::ieee754_different(_value, _cloud_value, Property::_min_delta_property);
5160
}

0 commit comments

Comments
 (0)