Test casting a JsonValue to a bool

This commit is contained in:
Benoit Blanchon
2014-08-01 14:54:34 +02:00
parent 23b5237f74
commit 028ff6676e
2 changed files with 11 additions and 0 deletions

View File

@ -59,6 +59,11 @@ namespace ArduinoJson
content.asDouble = value; content.asDouble = value;
} }
operator bool()
{
return content.asBool;
}
operator const char*() operator const char*()
{ {
return ""; return "";

View File

@ -34,6 +34,12 @@ namespace JsonGeneratorTests
setValueAndCheckCast(42L); setValueAndCheckCast(42L);
} }
TEST_METHOD(Bool)
{
setValueAndCheckCast(true);
setValueAndCheckCast(false);
}
private: private:
template<typename T> template<typename T>