MCPcopy Create free account
hub / github.com/boostorg/json / testMakeValue

Method testMakeValue

test/value_ref.cpp:217–300  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

215 }
216
217 void
218 testMakeValue()
219 {
220 // scalars
221 make_value({(short)-1}, "[-1]");
222 make_value({(int)-2}, "[-2]");
223 make_value({(long)-3}, "[-3]");
224 make_value({(long long)-4}, "[-4]");
225 make_value({(unsigned short)1}, "[1]");
226 make_value({(unsigned int)2}, "[2]");
227 make_value({(unsigned long)3}, "[3]");
228 make_value({(unsigned long long)4}, "[4]");
229 //make_value({(float)1.}, "[1]");
230 //make_value({(double)1.}, "[1]");
231 make_value({true}, "[true]");
232 make_value({nullptr}, "[null]");
233
234 // string_view
235 make_value({string_view("5")}, "[\"5\"]");
236 make_value({"6"}, "[\"6\"]");
237
238 // value
239 {
240 make_value({value(1)}, "[1]");
241 value const v(1);
242 make_value({v}, "[1]");
243 make_value({value(2)}, "[2]");
244 }
245
246 // object
247 {
248 make_value({object({{"k1",1},{"k2",2}})}, "[{\"k1\":1,\"k2\":2}]");
249 object const obj({{"k1",1},{"k2",2}});
250 make_value({obj}, "[{\"k1\":1,\"k2\":2}]");
251 }
252
253 // array
254 {
255 make_value({array({1,2,3})}, "[[1,2,3]]");
256 array const arr({1,2,3});
257 make_value({arr}, "[[1,2,3]]");
258 }
259
260 // string
261 {
262 make_value({string("test")}, "[\"test\"]");
263 string const str("test");
264 make_value({str}, "[\"test\"]");
265 }
266
267 // init list with size != 2
268 {
269 make_value({{1,2,3}}, "[[1,2,3]]");
270 }
271
272 // `string` as key
273 {
274 make_value({

Callers

nothing calls this directly

Calls 5

string_viewClass · 0.85
valueClass · 0.70
objectClass · 0.50
arrayClass · 0.50
stringClass · 0.50

Tested by

no test coverage detected