Lines Matching refs:j
21 json j = true; variable
22 json k = j;
24 j.clear();
25 CHECK(j == json(json::value_t::boolean));
26 CHECK(j == json(k.type()));
31 json j = "hello world"; variable
32 json k = j;
34 j.clear();
35 CHECK(j == json(json::value_t::string));
36 CHECK(j == json(k.type()));
43 json j = json::array(); variable
44 json k = j;
46 j.clear();
47 CHECK(j.empty());
48 CHECK(j == json(json::value_t::array));
49 CHECK(j == json(k.type()));
54 json j = {1, 2, 3}; variable
55 json k = j;
57 j.clear();
58 CHECK(j.empty());
59 CHECK(j == json(json::value_t::array));
60 CHECK(j == json(k.type()));
68 json j = json::object(); variable
69 json k = j;
71 j.clear();
72 CHECK(j.empty());
73 CHECK(j == json(json::value_t::object));
74 CHECK(j == json(k.type()));
79 json j = {{"one", 1}, {"two", 2}, {"three", 3}}; variable
80 json k = j;
82 j.clear();
83 CHECK(j.empty());
84 CHECK(j == json(json::value_t::object));
85 CHECK(j == json(k.type()));
93 json j = json::binary({}); variable
94 json k = j;
96 j.clear();
97 CHECK(!j.empty());
98 CHECK(j == json(json::value_t::binary));
99 CHECK(j == json(k.type()));
104 json j = json::binary({1, 2, 3, 4, 5}); variable
105 json k = j;
107 j.clear();
108 CHECK(!j.empty());
109 CHECK(j == json(json::value_t::binary));
110 CHECK(j == json(k.type()));
116 json j = 23; variable
117 json k = j;
119 j.clear();
120 CHECK(j == json(json::value_t::number_integer));
121 CHECK(j == json(k.type()));
126 json j = 23u; variable
127 json k = j;
129 j.clear();
130 CHECK(j == json(json::value_t::number_integer));
131 CHECK(j == json(k.type()));
136 json j = 23.42; variable
137 json k = j;
139 j.clear();
140 CHECK(j == json(json::value_t::number_float));
141 CHECK(j == json(k.type()));
146 json j = nullptr; variable
147 json k = j;
149 j.clear();
150 CHECK(j == json(json::value_t::null));
151 CHECK(j == json(k.type()));
163 json j; variable
164 j.push_back(1);
165 j.push_back(2);
166 CHECK(j.type() == json::value_t::array);
167 CHECK(j == json({1, 2}));
172 json j = {1, 2, 3}; variable
173 j.push_back("Hello");
174 CHECK(j.type() == json::value_t::array);
175 CHECK(j == json({1, 2, 3, "Hello"}));
180 json j = 1; variable
181 …CHECK_THROWS_WITH_AS(j.push_back("Hello"), "[json.exception.type_error.308] cannot use push_back()…
189 json j; variable
191 j.push_back(k);
192 j.push_back(k);
193 CHECK(j.type() == json::value_t::array);
194 CHECK(j == json({1, 1}));
199 json j = {1, 2, 3}; variable
201 j.push_back(k);
202 CHECK(j.type() == json::value_t::array);
203 CHECK(j == json({1, 2, 3, "Hello"}));
208 json j = 1; variable
210 …CHECK_THROWS_WITH_AS(j.push_back(k), "[json.exception.type_error.308] cannot use push_back() with …
219 json j; variable
220 j.push_back(json::object_t::value_type({"one", 1}));
221 j.push_back(json::object_t::value_type({"two", 2}));
222 CHECK(j.type() == json::value_t::object);
223 CHECK(j.size() == 2);
224 CHECK(j["one"] == json(1));
225 CHECK(j["two"] == json(2));
230 json j(json::value_t::object);
231 j.push_back(json::object_t::value_type({"one", 1}));
232 j.push_back(json::object_t::value_type({"two", 2}));
233 CHECK(j.size() == 2);
234 CHECK(j["one"] == json(1));
235 CHECK(j["two"] == json(2));
240 json j = 1; variable
242 …CHECK_THROWS_WITH_AS(j.push_back(json::object_t::value_type({"one", 1})), "[json.exception.type_er…
250 json j; variable
251 j.push_back({"foo", "bar"});
252 CHECK(j == json::array({{"foo", "bar"}}));
261 json j = {1, 2, 3}; variable
262 j.push_back({"foo", "bar"});
263 CHECK(j == json({1, 2, 3, {"foo", "bar"}}));
272 json j = {{"key1", 1}}; variable
273 j.push_back({"key2", "bar"});
274 CHECK(j == json({{"key1", 1}, {"key2", "bar"}}));
277 …CHECK_THROWS_WITH_AS(j.push_back({1}), "[json.exception.type_error.308] cannot use push_back() wit…
278 …CHECK_THROWS_WITH_AS(j.push_back({1, 2}), "[json.exception.type_error.308] cannot use push_back() …
279 …CHECK_THROWS_WITH_AS(j.push_back({1, 2, 3, 4}), "[json.exception.type_error.308] cannot use push_b…
290 json j; variable
291 auto& x1 = j.emplace_back(1);
293 auto& x2 = j.emplace_back(2);
295 CHECK(j.type() == json::value_t::array);
296 CHECK(j == json({1, 2}));
301 json j = {1, 2, 3}; variable
302 auto& x = j.emplace_back("Hello");
304 CHECK(j.type() == json::value_t::array);
305 CHECK(j == json({1, 2, 3, "Hello"}));
310 json j; variable
311 auto& x = j.emplace_back(3, "foo");
313 CHECK(j.type() == json::value_t::array);
314 CHECK(j == json({{"foo", "foo", "foo"}}));
320 json j = 1; variable
321 …CHECK_THROWS_WITH_AS(j.emplace_back("Hello"), "[json.exception.type_error.311] cannot use emplace_…
332 json j; variable
335 auto res1 = j.emplace("foo", "bar");
340 CHECK(j.type() == json::value_t::object);
343 auto res2 = j.emplace("baz", "bam");
348 auto res3 = j.emplace("baz", "bad");
353 CHECK(j == json({{"baz", "bam"}, {"foo", "bar"}}));
359 json j = {{"foo", "bar"}}; variable
362 auto res1 = j.emplace("baz", "bam");
367 auto res2 = j.emplace("foo", "bad");
372 CHECK(j == json({{"baz", "bam"}, {"foo", "bar"}}));
378 json j = 1; variable
379 …CHECK_THROWS_WITH_AS(j.emplace("foo", "bar"), "[json.exception.type_error.311] cannot use emplace(…
391 json j; variable
392 j += 1;
393 j += 2;
394 CHECK(j.type() == json::value_t::array);
395 CHECK(j == json({1, 2}));
400 json j = {1, 2, 3}; variable
401 j += "Hello";
402 CHECK(j.type() == json::value_t::array);
403 CHECK(j == json({1, 2, 3, "Hello"}));
408 json j = 1; variable
409 …CHECK_THROWS_WITH_AS(j += "Hello", "[json.exception.type_error.308] cannot use push_back() with nu…
417 json j; variable
419 j += k;
420 j += k;
421 CHECK(j.type() == json::value_t::array);
422 CHECK(j == json({1, 1}));
427 json j = {1, 2, 3}; variable
429 j += k;
430 CHECK(j.type() == json::value_t::array);
431 CHECK(j == json({1, 2, 3, "Hello"}));
436 json j = 1; variable
438 …CHECK_THROWS_WITH_AS(j += k, "[json.exception.type_error.308] cannot use push_back() with number",…
447 json j; variable
448 j += json::object_t::value_type({"one", 1});
449 j += json::object_t::value_type({"two", 2});
450 CHECK(j.type() == json::value_t::object);
451 CHECK(j.size() == 2);
452 CHECK(j["one"] == json(1));
453 CHECK(j["two"] == json(2));
458 json j(json::value_t::object);
459 j += json::object_t::value_type({"one", 1});
460 j += json::object_t::value_type({"two", 2});
461 CHECK(j.size() == 2);
462 CHECK(j["one"] == json(1));
463 CHECK(j["two"] == json(2));
468 json j = 1; variable
470 …CHECK_THROWS_WITH_AS(j += json::object_t::value_type({"one", 1}), "[json.exception.type_error.308]…
478 json j; variable
479 j += {"foo", "bar"};
480 CHECK(j == json::array({{"foo", "bar"}}));
489 json j = {1, 2, 3}; variable
490 j += {"foo", "bar"};
491 CHECK(j == json({1, 2, 3, {"foo", "bar"}}));
500 json j = {{"key1", 1}}; variable
501 j += {"key2", "bar"};
502 CHECK(j == json({{"key1", 1}, {"key2", "bar"}}));
815 json j("hello world"); variable
818 j.swap(k);
820 CHECK(j == json(42.23));
826 json j("hello world"); variable
830 swap(j, k);
832 CHECK(j == json(42.23));
841 json j = {1, 2, 3, 4}; variable
844 j.swap(a);
846 CHECK(j == json({"foo", "bar", "baz"}));
848 j.swap(a);
850 CHECK(j == json({1, 2, 3, 4}));
855 json j = 17; variable
858 …CHECK_THROWS_WITH_AS(j.swap(a), "[json.exception.type_error.310] cannot use swap(array_t&) with nu…
866 json j = {{"one", 1}, {"two", 2}}; variable
869 j.swap(o);
871 CHECK(j == json({{"cow", "Kuh"}, {"chicken", "Huhn"}}));
873 j.swap(o);
875 CHECK(j == json({{"one", 1}, {"two", 2}}));
880 json j = 17; variable
883 …CHECK_THROWS_WITH_AS(j.swap(o), "[json.exception.type_error.310] cannot use swap(object_t&) with n…
891 json j = "Hello world"; variable
894 j.swap(s);
896 CHECK(j == json("Hallo Welt"));
898 j.swap(s);
900 CHECK(j == json("Hello world"));
905 json j = 17; variable
908 …CHECK_THROWS_WITH_AS(j.swap(s), "[json.exception.type_error.310] cannot use swap(string_t&) with n…
916 json j = json::binary({1, 2, 3, 4}); variable
919 j.swap(s);
921 CHECK(j == json::binary({5, 6, 7, 8}));
923 j.swap(s);
925 CHECK(j == json::binary({1, 2, 3, 4}));
930 json j = json::binary({1, 2, 3, 4}); variable
933 j.swap(s);
935 CHECK(j == json::binary({5, 6, 7, 8}));
937 j.swap(s);
939 CHECK(j == json::binary({1, 2, 3, 4}));
944 json j = 17; variable
948 …CHECK_THROWS_WITH_AS(j.swap(s1), "[json.exception.type_error.310] cannot use swap(binary_t&) with …
949 …CHECK_THROWS_WITH_AS(j.swap(s2), "[json.exception.type_error.310] cannot use swap(binary_t::contai…