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

Method testExceptions

test/array.cpp:1213–1294  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1211 }
1212
1213 void
1214 testExceptions()
1215 {
1216 // operator=(array const&)
1217 fail_loop([&](storage_ptr const& sp)
1218 {
1219 array a0({1, true, str_});
1220 array a1;
1221 array a(sp);
1222 a.emplace_back(nullptr);
1223 a = a0;
1224 a1 = a;
1225 check(a1);
1226 });
1227
1228 // operator=(init_list)
1229 fail_loop([&](storage_ptr const& sp)
1230 {
1231 init_list init{ 1, true, str_ };
1232 array a1;
1233 array a(sp);
1234 a.emplace_back(nullptr);
1235 a = init;
1236 a1 = a;
1237 check(a1);
1238 });
1239
1240 // insert(const_iterator, count, value_type const&)
1241 fail_loop([&](storage_ptr const& sp)
1242 {
1243 array a1;
1244 array a({1, true}, sp);
1245 a.insert(a.begin() + 1,
1246 3, nullptr);
1247 a1 = a;
1248 BOOST_TEST(a1.size() == 5);
1249 BOOST_TEST(a1[0].is_number());
1250 BOOST_TEST(a1[1].is_null());
1251 BOOST_TEST(a1[2].is_null());
1252 BOOST_TEST(a1[3].is_null());
1253 BOOST_TEST(a1[4].is_bool());
1254 });
1255
1256 // insert(const_iterator, InputIt, InputIt)
1257 fail_loop([&](storage_ptr const& sp)
1258 {
1259 init_list init{ 1, true, str_ };
1260 array a1;
1261 array a(sp);
1262 a.insert(a.end(),
1263 init.begin(), init.end());
1264 a1 = a;
1265 check(a1);
1266 });
1267
1268 // emplace(const_iterator, arg)
1269 fail_loop([&](storage_ptr const& sp)
1270 {

Callers

nothing calls this directly

Calls 11

fail_loopFunction · 0.85
checkFunction · 0.85
is_numberMethod · 0.80
is_nullMethod · 0.80
is_boolMethod · 0.80
emplaceMethod · 0.80
is_stringMethod · 0.80
insertMethod · 0.45
beginMethod · 0.45
sizeMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected