This test case decodes JSON nested much deeper (see safetyFactor) than the default depth limit and performs some * operations on the resulting values. This is done with its limited stack size on order to verify that the default * limit is low enough to be safe. Note that this isn't an exact science unfortunately: other recursive operations may * have larger stack frames and these operations are
| 296 | * the Boost version), once in a pthread thread (which may not be available everywhere). |
| 297 | */ |
| 298 | static void TestJsonStackSize() |
| 299 | { |
| 300 | constexpr size_t safetyFactor = 10; |
| 301 | constexpr size_t depth = JsonDecodeDefaultDepthLimit * safetyFactor; |
| 302 | |
| 303 | Value val; |
| 304 | |
| 305 | BOOST_REQUIRE_NO_THROW(val = JsonDecode(MakeNestedJsonArray(depth), depth)); |
| 306 | BOOST_REQUIRE_NO_THROW(val.Clone()); |
| 307 | BOOST_REQUIRE_NO_THROW(Convert::ToString(val)); |
| 308 | BOOST_REQUIRE_NO_THROW(JsonDecode(JsonEncode(val), depth)); |
| 309 | |
| 310 | BOOST_REQUIRE_NO_THROW(val = JsonDecode(MakeNestedJsonObject(depth), depth)); |
| 311 | BOOST_REQUIRE_NO_THROW(val.Clone()); |
| 312 | BOOST_REQUIRE_NO_THROW(Convert::ToString(val)); |
| 313 | BOOST_REQUIRE_NO_THROW(JsonDecode(JsonEncode(val), depth)); |
| 314 | } |
| 315 | |
| 316 | BOOST_AUTO_TEST_CASE(stack_size_coroutine) |
| 317 | { |
no test coverage detected