mirror of
https://github.com/nlohmann/json.git
synced 2026-09-29 11:10:30 +00:00
Diff fewer nesting depths so the test does not time out under Valgrind
Checking every depth up to 300 made test-json_patch exceed the 1500 s ctest timeout in ci_test_valgrind. Check the depths up to 16, those around the recursion limit of 128, and 300 instead. Signed-off-by: Niels Lohmann <mail@nlohmann.me>
This commit is contained in:
@@ -16,6 +16,7 @@ using nlohmann::json;
|
|||||||
|
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <vector>
|
||||||
#include "make_test_data_available.hpp"
|
#include "make_test_data_available.hpp"
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
@@ -1812,9 +1813,21 @@ TEST_CASE("JSON patch: diff of deeply nested values")
|
|||||||
{
|
{
|
||||||
SECTION("the diff reproduces the target at every depth")
|
SECTION("the diff reproduces the target at every depth")
|
||||||
{
|
{
|
||||||
// every depth on either side of the nesting depth up to which diff()
|
// depths on either side of the nesting depth up to which diff()
|
||||||
// recurses (detail::recursion_depth_limit(), 128)
|
// recurses (detail::recursion_depth_limit(), 128); not every depth up
|
||||||
for (std::size_t depth = 0; depth <= 300; ++depth)
|
// to 300, as the test would then time out under Valgrind
|
||||||
|
std::vector<std::size_t> depths;
|
||||||
|
for (std::size_t depth = 0; depth <= 16; ++depth)
|
||||||
|
{
|
||||||
|
depths.push_back(depth);
|
||||||
|
}
|
||||||
|
for (std::size_t depth = 120; depth <= 136; ++depth)
|
||||||
|
{
|
||||||
|
depths.push_back(depth);
|
||||||
|
}
|
||||||
|
depths.push_back(300);
|
||||||
|
|
||||||
|
for (const auto depth : depths)
|
||||||
{
|
{
|
||||||
CAPTURE(depth);
|
CAPTURE(depth);
|
||||||
for (int from = 0; from < 3; ++from)
|
for (int from = 0; from < 3; ++from)
|
||||||
|
|||||||
Reference in New Issue
Block a user