made another test parametric, started to struggle with segfaults.

This commit is contained in:
Kjistóf 2016-10-23 23:48:20 +02:00
parent 80f0c71445
commit 0bf31cb6e4

View File

@ -23,6 +23,8 @@ struct StreamStringTest : public ::testing::Test
std::stringstream _stream; std::stringstream _stream;
}; };
class SingleParamStringTest : public ::testing::TestWithParam<std::tuple<const char*>> {};
/////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////
/// Testing data /// /// Testing data ///
/////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////
@ -44,6 +46,15 @@ static const std::vector<strcharstr> testvalues2 =
std::make_tuple("te", 'j', "tej") std::make_tuple("te", 'j', "tej")
}; };
static const std::vector<std::tuple<const char*>> testvalues3 =
{
std::make_tuple("cica"),
std::make_tuple("sajt"),
std::make_tuple("sör"),
std::make_tuple("C++11"),
std::make_tuple("suchInitializerList")
};
/////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////
/// Tests /// /// Tests ///
/////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////
@ -128,13 +139,14 @@ TEST_P(addCharStringTest, plusEqualsCharable)
} }
INSTANTIATE_TEST_CASE_P(testGroup1, addCharStringTest, ::testing::ValuesIn(testvalues2)); INSTANTIATE_TEST_CASE_P(testGroup1, addCharStringTest, ::testing::ValuesIn(testvalues2));
TEST(StringTest, comparable) TEST_P(SingleParamStringTest, comparable)
{ {
String str1("cica"); String str1(std::get<0>(GetParam()));
String str2("cica"); String str2(std::get<0>(GetParam()));
EXPECT_EQ(str1, str2); EXPECT_EQ(str1, str2);
} }
INSTANTIATE_TEST_CASE_P(testGroup1, SingleParamStringTest, ::testing::ValuesIn(testvalues3));
TEST(StringTest, uninitializedStringCompareThrows) TEST(StringTest, uninitializedStringCompareThrows)
{ {