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

Method testIf

test/value.cpp:1243–1431  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1241 }
1242
1243 void
1244 testIf()
1245 {
1246 value obj(object{});
1247 value arr(array{});
1248 value str(string{});
1249 value i64(std::int64_t{});
1250 value u64(std::uint64_t{});
1251 value dub(double{});
1252 value boo(true);
1253 value nul(nullptr);
1254
1255 auto const& cobj(obj);
1256 auto const& carr(arr);
1257 auto const& cstr(str);
1258 auto const& ci64(i64);
1259 auto const& cu64(u64);
1260 auto const& cdub(dub);
1261 auto const& cboo(boo);
1262 auto const& cnul(nul);
1263
1264 // if_object()
1265 {
1266 BOOST_TEST(obj.if_object() != nullptr);
1267 BOOST_TEST(arr.if_object() == nullptr);
1268 BOOST_TEST(str.if_object() == nullptr);
1269 BOOST_TEST(i64.if_object() == nullptr);
1270 BOOST_TEST(u64.if_object() == nullptr);
1271 BOOST_TEST(dub.if_object() == nullptr);
1272 BOOST_TEST(boo.if_object() == nullptr);
1273 BOOST_TEST(nul.if_object() == nullptr);
1274 }
1275
1276 // if_object() const
1277 {
1278 BOOST_TEST(cobj.if_object() != nullptr);
1279 BOOST_TEST(carr.if_object() == nullptr);
1280 BOOST_TEST(cstr.if_object() == nullptr);
1281 BOOST_TEST(ci64.if_object() == nullptr);
1282 BOOST_TEST(cu64.if_object() == nullptr);
1283 BOOST_TEST(cdub.if_object() == nullptr);
1284 BOOST_TEST(cboo.if_object() == nullptr);
1285 BOOST_TEST(cnul.if_object() == nullptr);
1286 }
1287
1288 // if_array()
1289 {
1290 BOOST_TEST(obj.if_array() == nullptr);
1291 BOOST_TEST(arr.if_array() != nullptr);
1292 BOOST_TEST(str.if_array() == nullptr);
1293 BOOST_TEST(i64.if_array() == nullptr);
1294 BOOST_TEST(u64.if_array() == nullptr);
1295 BOOST_TEST(dub.if_array() == nullptr);
1296 BOOST_TEST(boo.if_array() == nullptr);
1297 BOOST_TEST(nul.if_array() == nullptr);
1298 }
1299
1300 // if_array() const

Callers

nothing calls this directly

Calls 7

if_objectMethod · 0.80
if_arrayMethod · 0.80
if_stringMethod · 0.80
if_int64Method · 0.80
if_uint64Method · 0.80
if_doubleMethod · 0.80
if_boolMethod · 0.80

Tested by

no test coverage detected