1
0

unit tests: coverage, settings

This commit is contained in:
2026-02-21 14:15:08 +02:00
parent ad55b1109d
commit 753a6e0e1d
7 changed files with 305 additions and 3 deletions

36
tests/trim_test.cpp Normal file
View File

@@ -0,0 +1,36 @@
#include <string>
#include <gmock/gmock.h>
#include <gtest/gtest.h>
#include "trim.hpp"
namespace {
using ::testing::StrEq;
struct TrimCase {
const char *source;
const char *expected;
};
class TrimTest : public ::testing::TestWithParam<TrimCase> {
};
TEST_P(TrimTest, ReturnsTrimmedString) {
const auto &param = 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{"", ""}
)
);
}