mirror of https://github.com/OpenRCT2/OpenRCT2.git
28 lines
706 B
C++
28 lines
706 B
C++
|
#include <string>
|
||
|
#include <tuple>
|
||
|
#include <gtest/gtest.h>
|
||
|
#include <openrct2/core/String.hpp>
|
||
|
|
||
|
using TCase = std::tuple<std::string, std::string>;
|
||
|
|
||
|
class StringTest : public testing::TestWithParam<TCase>
|
||
|
{
|
||
|
};
|
||
|
|
||
|
INSTANTIATE_TEST_CASE_P(TrimData, StringTest, testing::Values(
|
||
|
TCase("string", "string"),
|
||
|
TCase(" string", "string"),
|
||
|
TCase("string ", "string"),
|
||
|
TCase(" some string ", "some string"),
|
||
|
TCase(" ", ""),
|
||
|
TCase("", "")
|
||
|
));
|
||
|
TEST_P(StringTest, Trim)
|
||
|
{
|
||
|
auto testCase = GetParam();
|
||
|
std::string input = std::get<0>(testCase);
|
||
|
std::string expected = std::get<1>(testCase);
|
||
|
std::string actual = String::Trim(input);
|
||
|
ASSERT_EQ(expected, actual);
|
||
|
}
|