Format the new string fast path test with astyle

The pinned astyle expands a braced-init-list used as a range-for range onto
several lines; hoist the two offsets into a named vector instead, which reads
better and leaves nothing for astyle to reformat.

Signed-off-by: Niels Lohmann <mail@nlohmann.me>
This commit is contained in:
Niels Lohmann committed 2026-08-20 02:00:30 +02:00
1 parent bdce31b5d2
commit 9373031609
1 file changed
+6 -6
+6 -6
View File
@@ -456,6 +456,10 @@ TEST_CASE("lexer string fast path")
} }
}; };
// once at the start of the string, once past the first 8-byte SWAR word, so
// the bulk scanner sees each case with and without a run behind it
const std::vector<std::size_t> offsets{0, 9};
SECTION("exhaustive contiguous vs streaming parity") SECTION("exhaustive contiguous vs streaming parity")
{ {
// ordinary ASCII, both specials, a control byte, characters that make // ordinary ASCII, both specials, a control byte, characters that make
@@ -485,9 +489,7 @@ TEST_CASE("lexer string fast path")
for (const auto& token : tokens) for (const auto& token : tokens)
{ {
// once at the start of the string, once past the first 8-byte for (const std::size_t offset : offsets)
// SWAR word so the bulk scanner has a run behind it
for (const std::size_t offset : {static_cast<std::size_t>(0), static_cast<std::size_t>(9)})
{ {
const std::string doc = "[\"" + std::string(offset, 'a') + token + "\"]"; const std::string doc = "[\"" + std::string(offset, 'a') + token + "\"]";
if (outcome(doc, false) != outcome(doc, true)) if (outcome(doc, false) != outcome(doc, true))
@@ -570,9 +572,7 @@ TEST_CASE("lexer string fast path")
for (const auto& test_case : cases) for (const auto& test_case : cases)
{ {
CAPTURE(test_case.description); CAPTURE(test_case.description);
// at the start of the string and past the first SWAR word, so the for (const std::size_t offset : offsets)
// sequence is seen by the bulk scanner and by its tail
for (const std::size_t offset : {static_cast<std::size_t>(0), static_cast<std::size_t>(9)})
{ {
CAPTURE(offset); CAPTURE(offset);
const std::string doc = "[\"" + std::string(offset, 'a') + test_case.sequence + "\"]"; const std::string doc = "[\"" + std::string(offset, 'a') + test_case.sequence + "\"]";