#include #include #include #include "trim.hpp" namespace { using ::testing::StrEq; struct TrimCase { const char *source; const char *expected; }; class TrimTest : public ::testing::TestWithParam { }; TEST_P(TrimTest, ReturnsTrimmedString) { const auto ¶m = GetParam(); std::string_view result = wavefront::trim(param.source); EXPECT_THAT(std::string(result), StrEq(param.expected)); } INSTANTIATE_TEST_SUITE_P( TrimCases, TrimTest, ::testing::Values( TrimCase{" hello world ", "hello world"}, TrimCase{"\t\n spaced\t\n", "spaced"}, TrimCase{"trimmed", "trimmed"}, TrimCase{" ", ""}, TrimCase{"", ""} ) ); }