20 #include <ripple/beast/unit_test.h>
21 #include <ripple/json/Object.h>
22 #include <test/json/TestOutputSuite.h>
49 TestOutputSuite::expectResult(expected);
71 root[
"hello"] =
"world";
73 root[
"awake"] =
false;
74 root[
"temperature"] = 98.6;
78 "{\"hello\":\"world\","
81 "\"temperature\":98.6}");
104 auto array = root.setArray(
"ar");
112 auto obj = root.setObject(
"obj");
113 obj[
"hello"] =
"world";
121 root[
"obj2"] = value;
127 "{\"ar\":[23,false,23.5],"
128 "\"obj\":{\"hello\":\"world\"},"
129 "\"obj2\":{\"h\":\"w\",\"f\":false}}";
131 "{\"ar\":[23,false,23.5],"
132 "\"obj\":{\"hello\":\"world\"},"
133 "\"obj2\":{\"f\":false,\"h\":\"w\"}}";
148 auto array = root.setArray(
"ar");
155 root.setObject(
"obj")[
"hello"] =
"world";
159 auto object = root.setObject(
"obj2");
160 object.set(
"h",
"w");
161 object.set(
"f",
false);
165 "{\"ar\":[23,false,23.5],"
166 "\"obj\":{\"hello\":\"world\"},"
167 "\"obj2\":{\"h\":\"w\",\"f\":false}}");
174 setup(
"object failure assign");
176 auto obj = root.setObject(
"o1");
180 setup(
"object failure object");
182 auto obj = root.setObject(
"o1");
186 setup(
"object failure Array");
188 auto obj = root.setArray(
"o1");
197 setup(
"array failure append");
199 auto array = root.setArray(
"array");
200 auto subarray = array.appendArray();
201 auto fail = [&]() { array.append(
"fail"); };
205 setup(
"array failure appendArray");
207 auto array = root.setArray(
"array");
208 auto subarray = array.appendArray();
209 auto fail = [&]() { array.appendArray(); };
213 setup(
"array failure appendObject");
215 auto array = root.setArray(
"array");
216 auto subarray = array.appendArray();
217 auto fail = [&]() { array.appendObject(); };
225 setup(
"repeating keys");
227 root.set(
"foo",
"bar");
230 auto set_again = [&]() { root.set(
"foo",
"bar"); };