Added RawJson() to insert pregenerated JSON portions (issue #259)

This commit is contained in:
Benoit Blanchon
2016-04-16 16:15:01 +02:00
parent c77c3f33ef
commit a6724bd03f
11 changed files with 131 additions and 130 deletions

View File

@ -8,8 +8,6 @@
#include <ArduinoJson.h>
#include <gtest/gtest.h>
using namespace ArduinoJson::Internals;
class JsonObject_PrintTo_Tests : public testing::Test {
public:
JsonObject_PrintTo_Tests() : _object(_jsonBuffer.createObject()) {}
@ -75,6 +73,12 @@ TEST_F(JsonObject_PrintTo_Tests, TwoIntegers) {
outputMustBe("{\"a\":1,\"b\":2}");
}
TEST_F(JsonObject_PrintTo_Tests, RawJson) {
_object["a"] = RawJson("[1,2]");
_object.set("b", RawJson("[4,5]"));
outputMustBe("{\"a\":[1,2],\"b\":[4,5]}");
}
TEST_F(JsonObject_PrintTo_Tests, TwoDoublesFourDigits) {
_object["a"] = double_with_n_digits(3.14159265358979323846, 4);
_object.set("b", 2.71828182845904523536, 4);