From a444597fc4b920b1949790949f65caea3dd50d03 Mon Sep 17 00:00:00 2001 From: Niels Lohmann Date: Sat, 31 Oct 2026 20:21:22 +0100 Subject: [PATCH] Fix ci_clang_tidy and GCC -Wconversion in unit-unicode.cpp ci_clang_tidy flagged the C array of pieces and the constant mt19937 seed (both intended, now NOLINT as elsewhere in the tests); ci_test_gcc failed on the narrowing of the mt19937 result to uint32_t (now an explicit cast). Signed-off-by: Niels Lohmann --- tests/src/unit-unicode.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/src/unit-unicode.cpp b/tests/src/unit-unicode.cpp index 0dc9e45be..72c8f812f 100644 --- a/tests/src/unit-unicode.cpp +++ b/tests/src/unit-unicode.cpp @@ -1639,19 +1639,19 @@ TEST_CASE("UTF-8 check of whole strings") // 16 bytes at a time where a vector check is available; it must agree with // the byte-wise check for every mix of ASCII, sequences of each length, // ill-formed and truncated sequences, at every length and offset - const char* const pieces[] = + const char* const pieces[] = // NOLINT(cppcoreguidelines-avoid-c-arrays,hicpp-avoid-c-arrays,modernize-avoid-c-arrays) { "a", "\x7F", "\xC3\xA9", "\xE2\x82\xAC", "\xE0\xA0\x80", "\xEF\xBF\xBF", "\xF0\x9F\x98\x80", "\xF4\x8F\xBF\xBF", "\x80", "\xC0\xAF", "\xC3", "\xE2\x82", "\xED\xA0\x80", "\xF0\x9F", "\xF4\x90\x80\x80", "\xFF" }; // std::mt19937's sequence is fixed by the standard; no distribution is used - std::mt19937 rng(5); + std::mt19937 rng(5); // NOLINT(cert-msc32-c,cert-msc51-cpp,bugprone-random-generator-seed) std::size_t valid = 0; for (int i = 0; i < 100000; ++i) { std::string s; const std::size_t length = rng() % 100; - const std::uint32_t ascii = rng() % 101; + const auto ascii = static_cast(rng() % 101); while (s.size() < length) { // mostly well-formed pieces (the first eight), so that long valid