Merge branch 'master' into jgrpp

# Conflicts:
#	src/crashlog.cpp
#	src/gfx.cpp
#	src/network/network_client.cpp
#	src/openttd.cpp
#	src/openttd.h
#	src/saveload/saveload.cpp
#	src/survey.cpp
This commit is contained in:
Jonathan G Rennison
2024-03-16 18:06:09 +00:00
32 changed files with 857 additions and 749 deletions

View File

@@ -385,3 +385,26 @@ TEST_CASE("ConvertHexToBytes")
CHECK(bytes3[6] == 0xde);
CHECK(bytes3[7] == 0xf0);
}
static const std::vector<std::pair<std::string, std::string>> _str_trim_testcases = {
{"a", "a"},
{" a", "a"},
{"a ", "a"},
{" a ", "a"},
{" a b c ", "a b c"},
{" ", ""}
};
TEST_CASE("StrTrimInPlace")
{
for (auto [input, expected] : _str_trim_testcases) {
StrTrimInPlace(input);
CHECK(input == expected);
}
}
TEST_CASE("StrTrimView") {
for (const auto& [input, expected] : _str_trim_testcases) {
CHECK(StrTrimView(input) == expected);
}
}