mirror of
https://github.com/eledio-devices/thirdparty-ArduinoJson.git
synced 2025-11-01 00:38:27 +01:00
Test casting a JsonValue to a double
This commit is contained in:
@@ -69,6 +69,11 @@ namespace ArduinoJson
|
|||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
operator double()
|
||||||
|
{
|
||||||
|
return content.asDouble;
|
||||||
|
}
|
||||||
|
|
||||||
operator int()
|
operator int()
|
||||||
{
|
{
|
||||||
return content.asLong;
|
return content.asLong;
|
||||||
|
|||||||
@@ -19,9 +19,15 @@ namespace JsonGeneratorTests
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
TEST_METHOD(String)
|
TEST_METHOD(Bool)
|
||||||
{
|
{
|
||||||
setValueAndCheckCast("hello");
|
setValueAndCheckCast(true);
|
||||||
|
setValueAndCheckCast(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_METHOD(Double)
|
||||||
|
{
|
||||||
|
setValueAndCheckCast(3.14156);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_METHOD(Integer)
|
TEST_METHOD(Integer)
|
||||||
@@ -34,10 +40,9 @@ namespace JsonGeneratorTests
|
|||||||
setValueAndCheckCast(42L);
|
setValueAndCheckCast(42L);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_METHOD(Bool)
|
TEST_METHOD(String)
|
||||||
{
|
{
|
||||||
setValueAndCheckCast(true);
|
setValueAndCheckCast("hello");
|
||||||
setValueAndCheckCast(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
Reference in New Issue
Block a user