Skip to content

Test "dump for basic_json with long double number_float_t" fails when run with Valgrind #5175

@nlohmann

Description

@nlohmann

Description

We recently added a test for long double (see #3929). This test fails when run with Valgrind.

Reproduction steps

Run test ci_test_valgrind.

Expected vs. actual results

Actual:

==4504== Memcheck, a memory error detector
==4504== Copyright (C) 2002-2022, and GNU GPL'd, by Julian Seward et al.
==4504== Using Valgrind-3.22.0 and LibVEX; rerun with -h for copyright info
==4504== Command: /home/runner/work/json/json/build/build_valgrind/tests/test-serialization_cpp11
==4504== 
[doctest] doctest version is "2.4.12"
[doctest] run with "--help" for options
===============================================================================
/home/runner/work/json/json/tests/src/unit-serialization.cpp:300:
TEST CASE:  dump for basic_json with long double number_float_t
  NaN and infinity dump as null

/home/runner/work/json/json/tests/src/unit-serialization.cpp:347: ERROR: CHECK( long_double_json(std::numeric_limits<long double>::infinity()).dump() == "null" ) is NOT correct!
  values: CHECK( 1.18973149535723176509e+4932 == null )

/home/runner/work/json/json/tests/src/unit-serialization.cpp:348: ERROR: CHECK( long_double_json(-std::numeric_limits<long double>::infinity()).dump() == "null" ) is NOT correct!
  values: CHECK( -1.18973149535723176509e+4932 == null )

===============================================================================
[doctest] test cases:   7 |   6 passed | 1 failed | 0 skipped
[doctest] assertions: 107 | 105 passed | 2 failed |
[doctest] Status: FAILURE!
==4504== 
==4504== HEAP SUMMARY:
==4504==     in use at exit: 0 bytes in 0 blocks
==4504==   total heap usage: 892 allocs, 892 frees, 227,982 bytes allocated
==4504== 
==4504== All heap blocks were freed -- no leaks are possible
==4504== 
==4504== For lists of detected and suppressed errors, rerun with: -s
==4504== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)

Minimal code example

N/A

Error messages

See above.

Compiler and operating system

g++ (Ubuntu 13.3.0-6ubuntu2~24.04.1) 13.3.0

Library version

develop

Validation

Metadata

Metadata

Assignees

Labels

kind: bugsolution: proposed fixa fix for the issue has been proposed and waits for confirmation

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions