forked from bblanchon/ArduinoJson
Don't use JsonBuffer to create or parse objects and arrays.
* Added DynamicJsonArray and StaticJsonArray * Added DynamicJsonObject and StaticJsonObject * Added DynamicJsonVariant and StaticJsonVariant * Added deserializeJson() * Removed JsonBuffer::parseArray(), parseObject() and parse() * Removed JsonBuffer::createArray() and createObject()
This commit is contained in:
@ -6,9 +6,10 @@
|
||||
#include <catch.hpp>
|
||||
|
||||
TEST_CASE("Gbathree") {
|
||||
DynamicJsonBuffer _buffer;
|
||||
DynamicJsonObject _object;
|
||||
|
||||
const JsonObject& _object = _buffer.parseObject(
|
||||
bool success = deserializeJson(
|
||||
_object,
|
||||
"{\"protocol_name\":\"fluorescence\",\"repeats\":1,\"wait\":0,"
|
||||
"\"averages\":1,\"measurements\":3,\"meas2_light\":15,\"meas1_"
|
||||
"baseline\":0,\"act_light\":20,\"pulsesize\":25,\"pulsedistance\":"
|
||||
@ -21,7 +22,7 @@ TEST_CASE("Gbathree") {
|
||||
"[15,15,15,15]],\"altc\":[2,2,2,2],\"altd\":[2,2,2,2]}");
|
||||
|
||||
SECTION("Success") {
|
||||
REQUIRE(_object.success());
|
||||
REQUIRE(success == true);
|
||||
}
|
||||
|
||||
SECTION("ProtocolName") {
|
||||
|
@ -6,13 +6,15 @@
|
||||
#include <catch.hpp>
|
||||
|
||||
void check(std::string originalJson) {
|
||||
DynamicJsonBuffer jb;
|
||||
DynamicJsonObject obj;
|
||||
|
||||
std::string prettyJson;
|
||||
jb.parseObject(originalJson).prettyPrintTo(prettyJson);
|
||||
deserializeJson(obj, originalJson);
|
||||
obj.prettyPrintTo(prettyJson);
|
||||
|
||||
std::string finalJson;
|
||||
jb.parseObject(prettyJson).printTo(finalJson);
|
||||
deserializeJson(obj, originalJson);
|
||||
obj.printTo(finalJson);
|
||||
|
||||
REQUIRE(originalJson == finalJson);
|
||||
}
|
||||
|
Reference in New Issue
Block a user