diff --git a/textwrap/include/textwrap/textwrap.h b/textwrap/include/textwrap/textwrap.h index 7360ba5..c936ac5 100644 --- a/textwrap/include/textwrap/textwrap.h +++ b/textwrap/include/textwrap/textwrap.h @@ -12,12 +12,12 @@ #pragma once -#include - #include #include #include +#include + /// Text wrapper public interface. namespace asap::wrap { diff --git a/textwrap/src/textwrap.cpp b/textwrap/src/textwrap.cpp index d87ec55..dbe568c 100644 --- a/textwrap/src/textwrap.cpp +++ b/textwrap/src/textwrap.cpp @@ -11,7 +11,6 @@ */ #include "textwrap/textwrap.h" -#include "tokenizer.h" #include #include @@ -20,6 +19,8 @@ #include #include +#include "tokenizer.h" + auto asap::wrap::operator<<(std::ostream &out, const asap::wrap::TextWrapper &wrapper) -> std::ostream & { out << "{w:" << wrapper.width_ << ",t:'" << wrapper.tab_ @@ -36,18 +37,12 @@ auto WrapChunks(const std::vector &chunks, // https://www.geeksforgeeks.org/word-wrap-problem-space-optimized-solution/ - auto num_chunks = chunks.size(); - auto first_line_width = width - initial_indent.size(); - auto other_line_witdh = width - indent.size(); - - size_t cur_chunk = 0; - size_t cur_chunk_in_line = 0; - - // Variable to store number of characters in given line. - size_t currlen = 0; + const auto num_chunks = chunks.size(); + const auto first_line_width = width - initial_indent.size(); + const auto other_line_width = width - indent.size(); - // Variable to store possible minimum cost of line. - size_t cost = 0; + size_t cur_chunk{0}; + size_t cur_chunk_in_line{0}; // Table in which costs[index] represents cost of line starting with word // chunks[index]. @@ -64,14 +59,21 @@ auto WrapChunks(const std::vector &chunks, optimized[num_chunks - 1] = num_chunks - 1; if (num_chunks > 1) { + + // Variable to store possible minimum cost of line. + size_t cost{0}; + // Make each word first word of line by iterating over each index in arr. cur_chunk = num_chunks - 1; do { cur_chunk--; - currlen = 0; + + // Variable to store number of characters in given line. + size_t currlen{0}; + costs[cur_chunk] = std::numeric_limits::max(); - auto adjusted_width = - (cur_chunk == 0 ? first_line_width : other_line_witdh); + const auto adjusted_width = + (cur_chunk == 0 ? first_line_width : other_line_width); cur_chunk_in_line = cur_chunk; if (trim_lines) { @@ -81,7 +83,7 @@ auto WrapChunks(const std::vector &chunks, cur_chunk_in_line++; } } - auto first_chunk_in_line = cur_chunk_in_line; + const auto first_chunk_in_line = cur_chunk_in_line; // Keep on adding words in current line by iterating from starting word // up to last word in arr. while (cur_chunk_in_line < num_chunks) { @@ -175,14 +177,14 @@ void MoveAppend(std::vector src, std::vector &dst) { [[nodiscard]] auto asap::wrap::TextWrapper::Wrap(const std::string &str) const -> std::optional> { - auto tokenizer = + const auto tokenizer = detail::Tokenizer(tab_, replace_ws_, collapse_ws_, break_on_hyphens_); std::vector result; std::vector chunks; - detail::TokenConsumer consume_token = [&chunks, this, &result]( - detail::TokenType token_type, - std::string token) -> void { + const detail::TokenConsumer consume_token = [&chunks, this, &result]( + detail::TokenType token_type, + std::string token) -> void { if ((token_type == detail::TokenType::ParagraphMark || token_type == detail::TokenType::EndOfInput) && !chunks.empty()) { @@ -207,11 +209,11 @@ void MoveAppend(std::vector src, std::vector &dst) { [[nodiscard]] auto asap::wrap::TextWrapper::Fill(const std::string &str) const -> std::optional { - auto wrap_opt = Wrap(str); + const auto wrap_opt = Wrap(str); if (!wrap_opt) { return {}; } - auto wrap = wrap_opt.value(); + const auto &wrap = wrap_opt.value(); std::string result; auto size = std::accumulate(wrap.cbegin(), wrap.cend(), static_cast(0), [](size_t acc, const std::string &line) { diff --git a/textwrap/src/tokenizer.cpp b/textwrap/src/tokenizer.cpp index f8591d4..1bb28ba 100644 --- a/textwrap/src/tokenizer.cpp +++ b/textwrap/src/tokenizer.cpp @@ -12,15 +12,14 @@ #include "tokenizer.h" -#include -#include - -#include - #include #include #include +#include + +#include + using asap::fsm::ByDefault; using asap::fsm::Continue; using asap::fsm::DoNothing; @@ -156,7 +155,7 @@ struct FinalState : public Will> { : consume_token_{std::move(callback)} { } - auto OnEnter(const InputEnd & /*event*/) -> Status { + [[maybe_unused]] auto OnEnter(const InputEnd & /*event*/) -> Status { consume_token_(TokenType::EndOfInput, ""); return Terminate{}; } @@ -197,7 +196,8 @@ struct WordState : public Will>, break_on_hyphens} { } - static auto OnEnter(const NonWhiteSpaceChar & /*event*/) -> Status { + [[maybe_unused]] static auto OnEnter(const NonWhiteSpaceChar & /*event*/) + -> Status { return ReissueEvent{}; } @@ -208,7 +208,7 @@ struct WordState : public Will>, return Continue{}; } - auto Handle(const NonWhiteSpaceChar &event) -> DoNothing { + [[maybe_unused]] auto Handle(const NonWhiteSpaceChar &event) -> DoNothing { if (break_on_hyphens_ && event.value == '-' && !token_.empty() && (std::isalpha(token_.back()) != 0)) { token_.push_back(event.value); @@ -246,7 +246,8 @@ struct WhiteSpaceState : public Will>, collapse_ws_{collapse_ws} { } - static auto OnEnter(const WhiteSpaceChar & /*event*/) -> Status { + [[maybe_unused]] static auto OnEnter(const WhiteSpaceChar & /*event*/) + -> Status { return ReissueEvent{}; } @@ -259,7 +260,7 @@ struct WhiteSpaceState : public Will>, return Continue{}; } - auto Handle(const WhiteSpaceChar &event) -> DoNothing { + [[maybe_unused]] auto Handle(const WhiteSpaceChar &event) -> DoNothing { if (event.value == '\n') { if (last_was_newline_) { token_.pop_back(); @@ -379,7 +380,7 @@ auto asap::wrap::detail::Tokenizer::Tokenize( reissue = false; // reuse the same token again } else { - cursor++; + ++cursor; } } } diff --git a/textwrap/src/tokenizer.h b/textwrap/src/tokenizer.h index 7fa6b8a..0f99bab 100644 --- a/textwrap/src/tokenizer.h +++ b/textwrap/src/tokenizer.h @@ -12,11 +12,10 @@ #pragma once -#include - #include #include -#include + +#include /// Internal implementation details for the text wrapper. namespace asap::wrap::detail { diff --git a/textwrap/test/textwrapper_example.cpp b/textwrap/test/textwrapper_example.cpp index ab285f8..60905ba 100644 --- a/textwrap/test/textwrapper_example.cpp +++ b/textwrap/test/textwrapper_example.cpp @@ -6,23 +6,8 @@ #include "textwrap/textwrap.h" -#include - #include -#include - -// Disable compiler and linter warnings originating from the unit test framework -// and for which we cannot do anything. Additionally, every TEST or TEST_X macro -// usage must be preceded by a '// NOLINTNEXTLINE'. -ASAP_DIAGNOSTIC_PUSH -#if defined(__clang__) && ASAP_HAS_WARNING("-Wused-but-marked-unused") -#pragma clang diagnostic ignored "-Wused-but-marked-unused" -#pragma clang diagnostic ignored "-Wglobal-constructors" -#pragma clang diagnostic ignored "-Wunused-member-function" -#endif -// NOLINTBEGIN(used-but-marked-unused) - namespace asap::wrap { namespace { @@ -36,15 +21,15 @@ TEST(TextWrapper, WrapExample) { "of a wife."; constexpr size_t column_width = 28; - TextWrapper title_wrapper = TextWrapper::Create().Width(column_width); - TextWrapper text_wrapper = TextWrapper::Create() - .Width(column_width) - .TrimLines() - .ReplaceWhiteSpace() - .CollapseWhiteSpace() - .IndentWith() - .Initially(" ") - .Then(" "); + const TextWrapper title_wrapper = TextWrapper::Create().Width(column_width); + const TextWrapper text_wrapper = TextWrapper::Create() + .Width(column_width) + .TrimLines() + .ReplaceWhiteSpace() + .CollapseWhiteSpace() + .IndentWith() + .Initially(" ") + .Then(" "); std::cout << title_wrapper.Fill(book).value_or("error") << std::endl; std::cout << text_wrapper.Fill(passage).value_or("error") << std::endl; @@ -62,6 +47,3 @@ TEST(TextWrapper, WrapExample) { } // namespace } // namespace asap::wrap - -// NOLINTEND(used-but-marked-unused) -ASAP_DIAGNOSTIC_POP diff --git a/textwrap/test/textwrapper_random_test.cpp b/textwrap/test/textwrapper_random_test.cpp index 2ad0d8d..1bb35e5 100644 --- a/textwrap/test/textwrapper_random_test.cpp +++ b/textwrap/test/textwrapper_random_test.cpp @@ -6,24 +6,13 @@ #include "textwrap/textwrap.h" -#include +#include +#include #include "gmock/gmock.h" #include -#include -#include - -// Disable compiler and linter warnings originating from the unit test framework -// and for which we cannot do anything. Additionally, every TEST or TEST_X macro -// usage must be preceded by a '// NOLINTNEXTLINE'. -ASAP_DIAGNOSTIC_PUSH -#if defined(__clang__) && ASAP_HAS_WARNING("-Wused-but-marked-unused") -#pragma clang diagnostic ignored "-Wused-but-marked-unused" -#pragma clang diagnostic ignored "-Wglobal-constructors" -#pragma clang diagnostic ignored "-Wunused-member-function" -#endif -// NOLINTBEGIN(used-but-marked-unused) +#include using ::testing::IsTrue; @@ -43,8 +32,8 @@ auto RandomWordChar() -> char { return static_cast(word_char_generator(rng)); } auto RandomWhiteSpace() -> char { - static const auto white_space = std::array{' ', ' ', ' ', ' ', - ' ', ' ', ' ', ' ', ' ', '\t', '\v', '\f', '\r', '\n'}; + static constexpr auto white_space = std::array{{' ', ' ', ' ', + ' ', ' ', ' ', ' ', ' ', ' ', '\t', '\v', '\f', '\r', '\n'}}; return (white_space.at(ws_generator(rng))); } auto GenerateWord(size_t length) -> std::string { @@ -77,6 +66,8 @@ auto GenerateText(size_t words) -> std::string { case 4: text += "."; break; + default: + ASAP_UNREACHABLE(); } text += GenerateWhiteSpace(ws_size_generator(rng)); } @@ -113,7 +104,7 @@ TEST(TextWrapper, RandomTests) { clock.tick(); for (size_t i = 1; i < maximum_text_length; ++i) { auto text = GenerateText(i); - auto size = text.size(); + const auto size = text.size(); for (size_t column_width = 3; column_width < size; ++column_width) { TextWrapper text_wrapper = TextWrapper::Create() .Width(column_width) @@ -131,6 +122,3 @@ TEST(TextWrapper, RandomTests) { } // namespace } // namespace asap::wrap - -// NOLINTEND(used-but-marked-unused) -ASAP_DIAGNOSTIC_POP diff --git a/textwrap/test/textwrapper_test.cpp b/textwrap/test/textwrapper_test.cpp index 4a78505..c12f4aa 100644 --- a/textwrap/test/textwrapper_test.cpp +++ b/textwrap/test/textwrapper_test.cpp @@ -6,24 +6,11 @@ #include "textwrap/textwrap.h" -#include +#include #include #include -#include - -// Disable compiler and linter warnings originating from the unit test framework -// and for which we cannot do anything. Additionally, every TEST or TEST_X macro -// usage must be preceded by a '// NOLINTNEXTLINE'. -ASAP_DIAGNOSTIC_PUSH -#if defined(__clang__) && ASAP_HAS_WARNING("-Wused-but-marked-unused") -#pragma clang diagnostic ignored "-Wused-but-marked-unused" -#pragma clang diagnostic ignored "-Wglobal-constructors" -#pragma clang diagnostic ignored "-Wunused-member-function" -#endif -// NOLINTBEGIN(used-but-marked-unused) - using ::testing::Eq; namespace asap::wrap { @@ -34,7 +21,7 @@ namespace { TEST(TextWrapperTest, ShortString) { constexpr size_t column_width = 30; const auto *text = "short string"; - TextWrapper wrapper = TextWrapper::Create().Width(column_width); + const TextWrapper wrapper = TextWrapper::Create().Width(column_width); EXPECT_THAT(wrapper.Fill(text).value(), Eq("short string")); } @@ -42,7 +29,7 @@ TEST(TextWrapperTest, ShortString) { TEST(TextWrapperTest, ExactString) { const auto *text = "short string"; const size_t column_width = std::strlen(text); - TextWrapper wrapper = TextWrapper::Create().Width(column_width); + const TextWrapper wrapper = TextWrapper::Create().Width(column_width); EXPECT_THAT(wrapper.Fill(text).value(), Eq("short string")); } @@ -75,7 +62,7 @@ TEST_P(LongStringTest, Fill) { builder.TrimLines(); } builder.IndentWith().Initially(initial_indent).Then(subsequent_indents); - TextWrapper wrapper = builder; + const TextWrapper wrapper = builder; EXPECT_THAT(wrapper.Fill(text).value(), Eq(expected)); } @@ -172,7 +159,7 @@ INSTANTIATE_TEST_SUITE_P(NoTrimLines, LongStringTest, TEST(TextWrapperTest, EmptyString) { constexpr size_t column_width = 30; const auto *text = ""; - TextWrapper wrapper = TextWrapper::Create().Width(column_width); + const TextWrapper wrapper = TextWrapper::Create().Width(column_width); EXPECT_THAT(wrapper.Fill(text).value(), Eq("")); } @@ -180,7 +167,7 @@ TEST(TextWrapperTest, EmptyString) { TEST(TextWrapperTest, Space) { constexpr size_t column_width = 30; const auto *text = " "; - TextWrapper wrapper = TextWrapper::Create().Width(column_width); + const TextWrapper wrapper = TextWrapper::Create().Width(column_width); EXPECT_THAT(wrapper.Fill(text).value(), Eq(" ")); } @@ -188,7 +175,7 @@ TEST(TextWrapperTest, Space) { TEST(TextWrapperTest, EmptyLine) { constexpr size_t column_width = 30; const auto *text = "\n"; - TextWrapper wrapper = TextWrapper::Create().Width(column_width); + const TextWrapper wrapper = TextWrapper::Create().Width(column_width); EXPECT_THAT(wrapper.Fill(text).value(), Eq("\n")); } @@ -196,7 +183,7 @@ TEST(TextWrapperTest, EmptyLine) { TEST(TextWrapperTest, OneShortWord) { constexpr size_t column_width = 30; const auto *text = "hello"; - TextWrapper wrapper = TextWrapper::Create().Width(column_width); + const TextWrapper wrapper = TextWrapper::Create().Width(column_width); EXPECT_THAT(wrapper.Fill(text).value(), Eq("hello")); } @@ -204,7 +191,7 @@ TEST(TextWrapperTest, OneShortWord) { TEST(TextWrapperTest, OneLongWord) { constexpr size_t column_width = 5; const auto *text = "unequivocally"; - TextWrapper wrapper = TextWrapper::Create().Width(column_width); + const TextWrapper wrapper = TextWrapper::Create().Width(column_width); EXPECT_THAT(wrapper.Fill(text).value(), Eq("unequivocally")); } @@ -212,11 +199,11 @@ TEST(TextWrapperTest, OneLongWord) { TEST(TextWrapperTest, IndentInitialOnly) { constexpr size_t column_width = 6; const auto *text = "hello world!"; - TextWrapper wrapper = TextWrapper::Create() - .Width(column_width) - .TrimLines() - .IndentWith() - .Initially("--- "); + const TextWrapper wrapper = TextWrapper::Create() + .Width(column_width) + .TrimLines() + .IndentWith() + .Initially("--- "); EXPECT_THAT(wrapper.Fill(text).value(), Eq("--- hello\nworld!")); } @@ -224,12 +211,12 @@ TEST(TextWrapperTest, IndentInitialOnly) { TEST(TextWrapperTest, IndentNoInitial) { constexpr size_t column_width = 6; const auto *text = "hello world!"; - TextWrapper wrapper = TextWrapper::Create() - .Width(column_width) - .TrimLines() - .IndentWith() - .Initially("") - .Then("--- "); + const TextWrapper wrapper = TextWrapper::Create() + .Width(column_width) + .TrimLines() + .IndentWith() + .Initially("") + .Then("--- "); EXPECT_THAT(wrapper.Fill(text).value(), Eq("hello\n--- world!")); } @@ -237,12 +224,12 @@ TEST(TextWrapperTest, IndentNoInitial) { TEST(TextWrapperTest, IndentAll) { constexpr size_t column_width = 6; const auto *text = "hello world!"; - TextWrapper wrapper = TextWrapper::Create() - .Width(column_width) - .TrimLines() - .IndentWith() - .Initially("== ") - .Then("---- "); + const TextWrapper wrapper = TextWrapper::Create() + .Width(column_width) + .TrimLines() + .IndentWith() + .Initially("== ") + .Then("---- "); EXPECT_THAT(wrapper.Fill(text).value(), Eq("== hello\n---- world!")); } @@ -250,12 +237,12 @@ TEST(TextWrapperTest, IndentAll) { TEST(TextWrapperTest, IndentOneWord) { constexpr size_t column_width = 3; const auto *text = "hello"; - TextWrapper wrapper = TextWrapper::Create() - .Width(column_width) - .TrimLines() - .IndentWith() - .Initially("== ") - .Then("---- "); + const TextWrapper wrapper = TextWrapper::Create() + .Width(column_width) + .TrimLines() + .IndentWith() + .Initially("== ") + .Then("---- "); EXPECT_THAT(wrapper.Fill(text).value(), Eq("== hello")); } @@ -263,12 +250,12 @@ TEST(TextWrapperTest, IndentOneWord) { TEST(TextWrapperTest, IndentExactWidth) { constexpr size_t column_width = 17; const auto *text = "hello world!"; - TextWrapper wrapper = TextWrapper::Create() - .Width(column_width) - .TrimLines() - .IndentWith() - .Initially("==== ") - .Then("---- "); + const TextWrapper wrapper = TextWrapper::Create() + .Width(column_width) + .TrimLines() + .IndentWith() + .Initially("==== ") + .Then("---- "); EXPECT_THAT(wrapper.Fill(text).value(), Eq("==== hello world!")); } @@ -276,12 +263,12 @@ TEST(TextWrapperTest, IndentExactWidth) { TEST(TextWrapperTest, IndentMultipleLines) { constexpr size_t column_width = 10; const auto *text = "bye world - welcome universe!"; - TextWrapper wrapper = TextWrapper::Create() - .Width(column_width) - .TrimLines() - .IndentWith() - .Initially("==== ") - .Then("---- "); + const TextWrapper wrapper = TextWrapper::Create() + .Width(column_width) + .TrimLines() + .IndentWith() + .Initially("==== ") + .Then("---- "); EXPECT_THAT(wrapper.Fill(text).value(), Eq("==== bye\n" "---- world\n" "---- -\n" @@ -293,11 +280,11 @@ TEST(TextWrapperTest, IndentMultipleLines) { TEST(TextWrapperTest, IndentEmptyStringNotIndented) { constexpr size_t column_width = 17; const auto *text = ""; - TextWrapper wrapper = TextWrapper::Create() - .Width(column_width) - .IndentWith() - .Initially("==== ") - .Then("---- "); + const TextWrapper wrapper = TextWrapper::Create() + .Width(column_width) + .IndentWith() + .Initially("==== ") + .Then("---- "); EXPECT_THAT(wrapper.Fill(text).value(), Eq("")); } @@ -305,17 +292,14 @@ TEST(TextWrapperTest, IndentEmptyStringNotIndented) { TEST(TextWrapperTest, IndentEmptyLineNotIndented) { constexpr size_t column_width = 17; const auto *text = "hello\n\n\nworld!"; - TextWrapper wrapper = TextWrapper::Create() - .Width(column_width) - .IndentWith() - .Initially("==== ") - .Then("---- "); + const TextWrapper wrapper = TextWrapper::Create() + .Width(column_width) + .IndentWith() + .Initially("==== ") + .Then("---- "); EXPECT_THAT(wrapper.Fill(text).value(), Eq("==== hello\n\n==== \nworld!")); } } // namespace } // namespace asap::wrap - -// NOLINTEND(used-but-marked-unused) -ASAP_DIAGNOSTIC_POP diff --git a/textwrap/test/tokenizer_test.cpp b/textwrap/test/tokenizer_test.cpp index a2e255e..15fb8d3 100644 --- a/textwrap/test/tokenizer_test.cpp +++ b/textwrap/test/tokenizer_test.cpp @@ -6,24 +6,11 @@ #include "tokenizer.h" -#include - -#include -#include - #include #include -// Disable compiler and linter warnings originating from the unit test framework -// and for which we cannot do anything. Additionally, every TEST or TEST_X macro -// usage must be preceded by a '// NOLINTNEXTLINE'. -ASAP_DIAGNOSTIC_PUSH -#if defined(__clang__) && ASAP_HAS_WARNING("-Wused-but-marked-unused") -#pragma clang diagnostic ignored "-Wused-but-marked-unused" -#pragma clang diagnostic ignored "-Wglobal-constructors" -#pragma clang diagnostic ignored "-Wunused-member-function" -#endif -// NOLINTBEGIN(used-but-marked-unused) +#include +#include using ::testing::Eq; using ::testing::IsTrue; @@ -40,11 +27,11 @@ TEST(TokenizerTest, Example) { constexpr bool collapse_ws = true; constexpr bool break_on_hyphens = true; - Tokenizer tokenizer{tab, replace_ws, collapse_ws, break_on_hyphens}; + const Tokenizer tokenizer{tab, replace_ws, collapse_ws, break_on_hyphens}; constexpr const char *text = "Why? \nJust plain \tfinger-licking good!"; std::vector tokens; - auto status = tokenizer.Tokenize( + const auto status = tokenizer.Tokenize( text, [&tokens](TokenType token_type, std::string token) { if (token_type != detail::TokenType::EndOfInput) { tokens.emplace_back(token_type, std::move(token)); @@ -56,7 +43,7 @@ TEST(TokenizerTest, Example) { // "finger-", "licking", " ", "good!" //! [Tokenizer example] - auto expected = std::vector{Token{TokenType::Chunk, "Why?"}, + const auto expected = std::vector{Token{TokenType::Chunk, "Why?"}, Token{TokenType::WhiteSpace, " "}, Token{TokenType::Chunk, "Just"}, Token{TokenType::WhiteSpace, " "}, Token{TokenType::Chunk, "plain"}, Token{TokenType::WhiteSpace, " "}, Token{TokenType::Chunk, "finger-"}, @@ -67,21 +54,21 @@ TEST(TokenizerTest, Example) { EXPECT_THAT(tokens.size(), Eq(10)); auto expected_token = expected.cbegin(); auto token = tokens.cbegin(); - auto end = tokens.cend(); + const auto end = tokens.cend(); while (token != end) { EXPECT_THAT(*token, Eq(*expected_token)); - token++; - expected_token++; + ++token; + ++expected_token; } } // NOLINTNEXTLINE TEST(TokenizerTest, CallsTokenConsumerWhenTokenIsReady) { - Tokenizer tokenizer{"\t", false, false, false}; + const Tokenizer tokenizer{"\t", false, false, false}; //! [Example token consumer] std::vector tokens; - auto status = tokenizer.Tokenize( + const auto status = tokenizer.Tokenize( "Hello", [&tokens](TokenType token_type, std::string token) { if (token_type != detail::TokenType::EndOfInput) { tokens.emplace_back(token_type, std::move(token)); @@ -114,10 +101,10 @@ class TokenizerScenariosTest : public ::testing::TestWithParam {}; TEST_P(TokenizerScenariosTest, Tokenize) { const auto &[text, tab, replace_ws, collapse_ws, break_on_hyphens, expected] = GetParam(); - Tokenizer tokenizer{tab, replace_ws, collapse_ws, break_on_hyphens}; + const Tokenizer tokenizer{tab, replace_ws, collapse_ws, break_on_hyphens}; std::vector tokens; - auto status = tokenizer.Tokenize( + const auto status = tokenizer.Tokenize( text, [&tokens](TokenType token_type, std::string token) { if (token_type != detail::TokenType::EndOfInput) { tokens.emplace_back(token_type, std::move(token)); @@ -128,11 +115,11 @@ TEST_P(TokenizerScenariosTest, Tokenize) { EXPECT_THAT(tokens.size(), Eq(expected.size())); auto expected_token = expected.cbegin(); auto token = tokens.cbegin(); - auto end = tokens.cend(); + const auto end = tokens.cend(); while (token != end) { EXPECT_THAT(*token, Eq(*expected_token)); - token++; - expected_token++; + ++token; + ++expected_token; } } @@ -352,6 +339,3 @@ INSTANTIATE_TEST_SUITE_P(BreakOnHyphensOn, TokenizerScenariosTest, } // namespace } // namespace asap::wrap::detail - -// NOLINTEND(used-but-marked-unused) -ASAP_DIAGNOSTIC_POP