Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3c38455c7d | ||
|
|
4571446da7 |
No files matched your search
+3
-1
@@ -178,8 +178,10 @@ function(_json_test_add_test test_name file main cxx_standard)
|
|||||||
COMMAND ${memcheck_command} $<TARGET_FILE:${test_target}> ${DOCTEST_TEST_FILTER}
|
COMMAND ${memcheck_command} $<TARGET_FILE:${test_target}> ${DOCTEST_TEST_FILTER}
|
||||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||||
)
|
)
|
||||||
|
# under Valgrind the slowest tests take close to 25 minutes, so ctest's
|
||||||
|
# default timeout of 1500 seconds leaves no headroom
|
||||||
set_tests_properties(${test_target}_valgrind PROPERTIES
|
set_tests_properties(${test_target}_valgrind PROPERTIES
|
||||||
LABELS "valgrind" FIXTURES_REQUIRED TEST_DATA
|
LABELS "valgrind" FIXTURES_REQUIRED TEST_DATA TIMEOUT 3600
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|||||||
@@ -222,8 +222,7 @@ class exception : public std::exception
|
|||||||
template<typename BasicJsonType>
|
template<typename BasicJsonType>
|
||||||
static std::string get_byte_positions(const BasicJsonType* leaf_element)
|
static std::string get_byte_positions(const BasicJsonType* leaf_element)
|
||||||
{
|
{
|
||||||
// a value-initialized iterator has no value (invalid_iterator.212)
|
if ((leaf_element->start_pos() != std::string::npos) && (leaf_element->end_pos() != std::string::npos))
|
||||||
if (leaf_element != nullptr && leaf_element->start_pos() != std::string::npos && leaf_element->end_pos() != std::string::npos)
|
|
||||||
{
|
{
|
||||||
return concat("(bytes ", std::to_string(leaf_element->start_pos()), "-", std::to_string(leaf_element->end_pos()), ") ");
|
return concat("(bytes ", std::to_string(leaf_element->start_pos()), "-", std::to_string(leaf_element->end_pos()), ") ");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2422,7 +2422,6 @@ class binary_writer
|
|||||||
nothing large has been written then, and the caller writes the
|
nothing large has been written then, and the caller writes the
|
||||||
document in two passes, which reports that error
|
document in two passes, which reports that error
|
||||||
*/
|
*/
|
||||||
template<typename SinkType = OutputSinkType, typename std::enable_if<is_detected<sink_written_t, SinkType>::value, int>::type = 0>
|
|
||||||
bool write_bson_document_single_pass(const BasicJsonType& document)
|
bool write_bson_document_single_pass(const BasicJsonType& document)
|
||||||
{
|
{
|
||||||
const std::size_t start = oa.written();
|
const std::size_t start = oa.written();
|
||||||
|
|||||||
Generated
+1
-3
@@ -5719,8 +5719,7 @@ class exception : public std::exception
|
|||||||
template<typename BasicJsonType>
|
template<typename BasicJsonType>
|
||||||
static std::string get_byte_positions(const BasicJsonType* leaf_element)
|
static std::string get_byte_positions(const BasicJsonType* leaf_element)
|
||||||
{
|
{
|
||||||
// a value-initialized iterator has no value (invalid_iterator.212)
|
if ((leaf_element->start_pos() != std::string::npos) && (leaf_element->end_pos() != std::string::npos))
|
||||||
if (leaf_element != nullptr && leaf_element->start_pos() != std::string::npos && leaf_element->end_pos() != std::string::npos)
|
|
||||||
{
|
{
|
||||||
return concat("(bytes ", std::to_string(leaf_element->start_pos()), "-", std::to_string(leaf_element->end_pos()), ") ");
|
return concat("(bytes ", std::to_string(leaf_element->start_pos()), "-", std::to_string(leaf_element->end_pos()), ") ");
|
||||||
}
|
}
|
||||||
@@ -30395,7 +30394,6 @@ class binary_writer
|
|||||||
nothing large has been written then, and the caller writes the
|
nothing large has been written then, and the caller writes the
|
||||||
document in two passes, which reports that error
|
document in two passes, which reports that error
|
||||||
*/
|
*/
|
||||||
template<typename SinkType = OutputSinkType, typename std::enable_if<is_detected<sink_written_t, SinkType>::value, int>::type = 0>
|
|
||||||
bool write_bson_document_single_pass(const BasicJsonType& document)
|
bool write_bson_document_single_pass(const BasicJsonType& document)
|
||||||
{
|
{
|
||||||
const std::size_t start = oa.written();
|
const std::size_t start = oa.written();
|
||||||
|
|||||||
@@ -243,14 +243,3 @@ TEST_CASE("values read from a binary format have no positions")
|
|||||||
check_no_positions(j);
|
check_no_positions(j);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("comparing a value-initialized iterator throws invalid_iterator.212")
|
|
||||||
{
|
|
||||||
// such an iterator has no value to take the byte positions from; the
|
|
||||||
// comparison used to dereference the null pointer instead of throwing
|
|
||||||
json j = {1, 2};
|
|
||||||
const json::iterator it{};
|
|
||||||
CHECK_THROWS_WITH_AS(it == j.begin(), "[json.exception.invalid_iterator.212] cannot compare iterators of different containers", json::invalid_iterator);
|
|
||||||
CHECK_THROWS_WITH_AS(it < j.begin(), "[json.exception.invalid_iterator.212] cannot compare iterators of different containers", json::invalid_iterator);
|
|
||||||
CHECK_THROWS_WITH_AS(j.begin() == it, "[json.exception.invalid_iterator.212] cannot compare iterators of different containers", json::invalid_iterator);
|
|
||||||
}
|
|
||||||
Reference in new issue
Block a user