Repository navigation
Reduce test suite runtime and run the Unicode tests everywhere - #5605
Merged
Merged
Conversation
5 tasks done
This was referenced Sep 30, 2026
Squashed onto develop from: - Cut Unicode ill-formed byte sweeps to one representative prefix - Pin unrelated bytes in the remaining ill-formed UTF-8 sweeps - Speed up unit-unicode1 - Run the cheap binary format size tests unconditionally - Compile unit-msgpack.cpp only once - Check the JSON Pointer roundtrip for every code point again - Cover every byte class in the ill-formed UTF-8 sweeps - Merge the Unicode tests into unit-unicode.cpp - Stop excluding the Unicode tests in CI Co-authored-by: elix3r <157088510+22elix3r@users.noreply.github.com> Signed-off-by: elix3r <157088510+22elix3r@users.noreply.github.com> Signed-off-by: Niels Lohmann <mail@nlohmann.me>
nlohmann
force-pushed
the
claude/issue-5418-5426-94fef8
branch
from
October 6, 2026 05:30
2c30264 to
b872c0a
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fixes #5418 by addressing everything that #5519 did not already cover. All changes are test-only.
Credit: the first commit is @22elix3r's change from #5426 (pin unrelated bytes in the wrong-2nd/3rd-byte UTF-8 sweeps), cherry-picked unchanged with authorship preserved. Thanks! This PR supersedes #5426.
Changes
Unicode ill-formed sweeps (
unit-unicode2..5.cpp): the "wrong Nth byte" sections swept the invalid byte through all 256 values and every valid value of the other continuation bytes, which multiplied the work.error_handler_t::ignore/replace, the serializer re-reads the invalid byte and decodes the bytes after it. Its decoder (detail::decode) tells three continuation classes apart: 0x80–8F, 0x90–9F and 0xA0–BF. The lexer's range checks use the same boundaries.utils::utf8_continuation_bytes). The invalid byte still takes all 256 values. This applies to all wrong-byte sections of unicode2–5.JSON_TEST_UTF8_EXHAUSTIVEswitches back to the full Cartesian product. I checked that this reproduces the exact assertion counts from develop (unicode2: 5,400,433; unicode5: 17,248,461).unit-unicode1.cpp:\uxxxxescapes are now formatted by hand instead of with astd::stringstreamper code point (~1.1 M calls). The JSON Pointer check still runs over every code point inall_unicode.json.unit-binary_formats.cpp:jeopardy.json(52 MB, ~20 s) moves into its owndoctest::skip()test case. The four small corpus files (~1.5 s) now also run inJSON_FastTestsconfigurations.unit-msgpack.cpp: the file mentionedJSON_HAS_CPP_17for onestd::bytetest case, so the whole file was also compiled and run astest-msgpack_cpp17. That test case moves tounit-msgpack-cpp17.cpp, following theunit-items-cpp17.cppprecedent.Merge the Unicode tests into
unit-unicode.cpp. They were split into five files in Refactor Unicode tests #2889 so they could run in parallel. They now take about 20 s together, so the split no longer pays off.test-unicode4timeout.Stop excluding the Unicode tests. They were excluded in two ways:
doctest::skip()meant noJSON_FastTestsconfiguration ran them. It is dropped.--exclude-regex "test-unicode"kept them out of theci.cmakecompiler matrix (g++-4.8 … clang++-20), the default, icpc, icpx and nvhpc jobs, the Windows MinGW and clang-cl jobs, and AppVeyor Debug builds. This is removed everywhere except the Valgrind job, which now excludes them explicitly; before,skip()kept them out there.What is still tested exhaustively
\uxxxxescape or surrogate pair.all_unicode.json: parsing and the JSON Pointer escape roundtrip.dump()variants. These sections are unchanged.Timings
The per-file rows are for the state before the merge. Unoptimized clang,
--no-skip, macOS arm64, wall time:test-unicode* This run was in parallel with the others. The rest were measured serially.
Breaking changes
None. Only tests changed; the library and the amalgamation are unaffected.
Checklist
This PR was written by Claude Code on behalf of @nlohmann.
🤖 Generated with Claude Code