1#include <test/json/TestOutputSuite.h> 
    3#include <xrpl/beast/unit_test.h> 
    4#include <xrpl/json/Object.h> 
   31        TestOutputSuite::expectResult(expected);
 
 
   53            root[
"hello"] = 
"world";
 
   55            root[
"awake"] = 
false;
 
   56            root[
"temperature"] = 98.6;
 
   60            "{\"hello\":\"world\"," 
   63            "\"temperature\":98.6}");
 
 
   86                auto array = root.setArray(
"ar");
 
   94                auto obj = root.setObject(
"obj");
 
   95                obj[
"hello"] = 
"world";
 
  103                root[
"obj2"] = value;
 
  109            "{\"ar\":[23,false,23.5]," 
  110            "\"obj\":{\"hello\":\"world\"}," 
  111            "\"obj2\":{\"h\":\"w\",\"f\":false}}";
 
  113            "{\"ar\":[23,false,23.5]," 
  114            "\"obj\":{\"hello\":\"world\"}," 
  115            "\"obj2\":{\"f\":false,\"h\":\"w\"}}";
 
 
  130                auto array = root.setArray(
"ar");
 
  137            root.setObject(
"obj")[
"hello"] = 
"world";
 
  141                auto object = root.setObject(
"obj2");
 
  142                object.set(
"h", 
"w");
 
  143                object.set(
"f", 
false);
 
  147            "{\"ar\":[23,false,23.5]," 
  148            "\"obj\":{\"hello\":\"world\"}," 
  149            "\"obj2\":{\"h\":\"w\",\"f\":false}}");
 
 
  156            setup(
"object failure assign");
 
  158            auto obj = root.setObject(
"o1");
 
  162            setup(
"object failure object");
 
  164            auto obj = root.setObject(
"o1");
 
  168            setup(
"object failure Array");
 
  170            auto obj = root.setArray(
"o1");
 
 
  179            setup(
"array failure append");
 
  181            auto array = root.setArray(
"array");
 
  182            auto subarray = array.appendArray();
 
  183            auto fail = [&]() { array.append(
"fail"); };
 
  187            setup(
"array failure appendArray");
 
  189            auto array = root.setArray(
"array");
 
  190            auto subarray = array.appendArray();
 
  191            auto fail = [&]() { array.appendArray(); };
 
  195            setup(
"array failure appendObject");
 
  197            auto array = root.setArray(
"array");
 
  198            auto subarray = array.appendArray();
 
  199            auto fail = [&]() { array.appendObject(); };
 
 
  207        setup(
"repeating keys");
 
  209        root.set(
"foo", 
"bar");
 
  212        auto set_again = [&]() { root.set(
"foo", 
"bar"); };
 
 
 
  237BEAST_DEFINE_TESTSUITE(JsonObject, json, 
ripple);
 
void setup(std::string const &testName)
 
void expectResult(std::string const &expected)
 
std::unique_ptr< WriterObject > writerObject_
 
void run() override
Runs the suite.
 
Represents a JSON object being written to a Writer.
 
void pass()
Record a successful test condition.
 
testcase_t testcase
Memberspace for declaring test cases.
 
void fail(String const &reason, char const *file, int line)
Record a failure.
 
bool expectException(Functor f, std::string const &message="")
 
JSON (JavaScript Object Notation).
 
WriterObject stringWriterObject(std::string &)
 
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.