Merge pull request #1454 from gennadiycivil/master

merges
This commit is contained in:
Gennadiy Civil 2018-02-13 12:26:47 -05:00 committed by GitHub
commit ffc5f5ad3c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -41,8 +41,8 @@
# include <sstream>
# include <string>
# include <vector>
# include "src/gtest-internal-inl.h" // for UnitTestOptions
# include "src/gtest-internal-inl.h" // for UnitTestOptions
# include "test/gtest-param-test_test.h"
using ::std::vector;
@ -536,6 +536,51 @@ TEST(CombineTest, CombineWithMaxNumberOfParameters) {
VerifyGenerator(gen, expected_values);
}
#if GTEST_LANG_CXX11
class NonDefaultConstructAssignString {
public:
NonDefaultConstructAssignString(const std::string& s) : str_(s) {}
const std::string& str() const { return str_; }
private:
std::string str_;
// Not default constructible
NonDefaultConstructAssignString();
// Not assignable
void operator=(const NonDefaultConstructAssignString&);
};
TEST(CombineTest, NonDefaultConstructAssign) {
const ParamGenerator<tuple<int, NonDefaultConstructAssignString> > gen =
Combine(Values(0, 1), Values(NonDefaultConstructAssignString("A"),
NonDefaultConstructAssignString("B")));
ParamGenerator<tuple<int, NonDefaultConstructAssignString> >::iterator it =
gen.begin();
EXPECT_EQ(0, std::get<0>(*it));
EXPECT_EQ("A", std::get<1>(*it).str());
++it;
EXPECT_EQ(0, std::get<0>(*it));
EXPECT_EQ("B", std::get<1>(*it).str());
++it;
EXPECT_EQ(1, std::get<0>(*it));
EXPECT_EQ("A", std::get<1>(*it).str());
++it;
EXPECT_EQ(1, std::get<0>(*it));
EXPECT_EQ("B", std::get<1>(*it).str());
++it;
EXPECT_TRUE(it == gen.end());
}
#endif // GTEST_LANG_CXX11
# endif // GTEST_HAS_COMBINE
// Tests that an generator produces correct sequence after being
@ -811,8 +856,8 @@ class CustomFunctorNamingTest : public TestWithParam<std::string> {};
TEST_P(CustomFunctorNamingTest, CustomTestNames) {}
struct CustomParamNameFunctor {
std::string operator()(const ::testing::TestParamInfo<std::string>& info) {
return info.param;
std::string operator()(const ::testing::TestParamInfo<std::string>& inf) {
return inf.param;
}
};
@ -829,8 +874,8 @@ INSTANTIATE_TEST_CASE_P(AllAllowedCharacters,
CustomParamNameFunctor());
inline std::string CustomParamNameFunction(
const ::testing::TestParamInfo<std::string>& info) {
return info.param;
const ::testing::TestParamInfo<std::string>& inf) {
return inf.param;
}
class CustomFunctionNamingTest : public TestWithParam<std::string> {};
@ -851,8 +896,8 @@ TEST_P(CustomLambdaNamingTest, CustomTestNames) {}
INSTANTIATE_TEST_CASE_P(CustomParamNameLambda,
CustomLambdaNamingTest,
Values(std::string("LambdaName")),
[](const ::testing::TestParamInfo<std::string>& tpinfo) {
return tpinfo.param;
[](const ::testing::TestParamInfo<std::string>& inf) {
return inf.param;
});
#endif // GTEST_LANG_CXX11
@ -1019,6 +1064,7 @@ TEST_F(ParameterizedDeathTest, GetParamDiesFromTestF) {
INSTANTIATE_TEST_CASE_P(RangeZeroToFive, ParameterizedDerivedTest, Range(0, 5));
int main(int argc, char **argv) {
// Used in TestGenerationTest test case.
AddGlobalTestEnvironment(TestGenerationTest::Environment::Instance());