Skip to content

Commit

Permalink
Code merge, upstreaming accumulated changes, cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
gennadiycivil committed Jan 10, 2018
1 parent 62dbaa2 commit 6a26e47
Show file tree
Hide file tree
Showing 5 changed files with 62 additions and 59 deletions.
41 changes: 22 additions & 19 deletions googletest/include/gtest/gtest-param-test.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
//
// This file is generated by a SCRIPT. DO NOT EDIT BY HAND!
//

#ifndef GTEST_INCLUDE_GTEST_GTEST_PARAM_TEST_H_
#define GTEST_INCLUDE_GTEST_GTEST_PARAM_TEST_H_

Expand Down Expand Up @@ -79,7 +80,7 @@ TEST_P(FooTest, HasBlahBlah) {
// Finally, you can use INSTANTIATE_TEST_CASE_P to instantiate the test
// case with any set of parameters you want. Google Test defines a number
// of functions for generating test parameters. They return what we call
// (surprise!) parameter generators. Here is a summary of them, which
// (surprise!) parameter generators. Here is a summary of them, which
// are all in the testing namespace:
//
//
Expand Down Expand Up @@ -268,7 +269,7 @@ internal::ParamGenerator<T> Range(T start, T end) {
// each with C-string values of "foo", "bar", and "baz":
//
// const char* strings[] = {"foo", "bar", "baz"};
// INSTANTIATE_TEST_CASE_P(StringSequence, SrtingTest, ValuesIn(strings));
// INSTANTIATE_TEST_CASE_P(StringSequence, StringTest, ValuesIn(strings));
//
// This instantiates tests from test case StlStringTest
// each with STL strings with values "a" and "b":
Expand Down Expand Up @@ -1413,24 +1414,26 @@ internal::CartesianProductHolder10<Generator1, Generator2, Generator3,
// alphanumeric characters or underscore. Because PrintToString adds quotes
// to std::string and C strings, it won't work for these types.

# define INSTANTIATE_TEST_CASE_P(prefix, test_case_name, generator, ...) \
static ::testing::internal::ParamGenerator<test_case_name::ParamType> \
gtest_##prefix##test_case_name##_EvalGenerator_() { return generator; } \
static ::std::string gtest_##prefix##test_case_name##_EvalGenerateName_( \
const ::testing::TestParamInfo<test_case_name::ParamType>& info) { \
return ::testing::internal::GetParamNameGen<test_case_name::ParamType> \
(__VA_ARGS__)(info); \
} \
#define INSTANTIATE_TEST_CASE_P(prefix, test_case_name, generator, ...) \
static ::testing::internal::ParamGenerator<test_case_name::ParamType> \
gtest_##prefix##test_case_name##_EvalGenerator_() { \
return generator; \
} \
static ::std::string gtest_##prefix##test_case_name##_EvalGenerateName_( \
const ::testing::TestParamInfo<test_case_name::ParamType>& info) { \
return ::testing::internal::GetParamNameGen<test_case_name::ParamType>( \
__VA_ARGS__)(info); \
} \
static int gtest_##prefix##test_case_name##_dummy_ GTEST_ATTRIBUTE_UNUSED_ = \
::testing::UnitTest::GetInstance()->parameterized_test_registry(). \
GetTestCasePatternHolder<test_case_name>(\
#test_case_name, \
::testing::internal::CodeLocation(\
__FILE__, __LINE__))->AddTestCaseInstantiation(\
#prefix, \
&gtest_##prefix##test_case_name##_EvalGenerator_, \
&gtest_##prefix##test_case_name##_EvalGenerateName_, \
__FILE__, __LINE__)
::testing::UnitTest::GetInstance() \
->parameterized_test_registry() \
.GetTestCasePatternHolder<test_case_name>( \
#test_case_name, \
::testing::internal::CodeLocation(__FILE__, __LINE__)) \
->AddTestCaseInstantiation( \
#prefix, &gtest_##prefix##test_case_name##_EvalGenerator_, \
&gtest_##prefix##test_case_name##_EvalGenerateName_, __FILE__, \
__LINE__)

} // namespace testing

Expand Down
4 changes: 2 additions & 2 deletions googletest/include/gtest/gtest-param-test.h.pump
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ TEST_P(FooTest, HasBlahBlah) {
// Finally, you can use INSTANTIATE_TEST_CASE_P to instantiate the test
// case with any set of parameters you want. Google Test defines a number
// of functions for generating test parameters. They return what we call
// (surprise!) parameter generators. Here is a summary of them, which
// (surprise!) parameter generators. Here is a summary of them, which
// are all in the testing namespace:
//
//
Expand Down Expand Up @@ -267,7 +267,7 @@ internal::ParamGenerator<T> Range(T start, T end) {
// each with C-string values of "foo", "bar", and "baz":
//
// const char* strings[] = {"foo", "bar", "baz"};
// INSTANTIATE_TEST_CASE_P(StringSequence, SrtingTest, ValuesIn(strings));
// INSTANTIATE_TEST_CASE_P(StringSequence, StringTest, ValuesIn(strings));
//
// This instantiates tests from test case StlStringTest
// each with STL strings with values "a" and "b":
Expand Down
2 changes: 1 addition & 1 deletion googletest/include/gtest/gtest-typed-test.h
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ INSTANTIATE_TYPED_TEST_CASE_P(My, FooTest, MyTypes);
} \
static const char* const GTEST_REGISTERED_TEST_NAMES_(CaseName) \
GTEST_ATTRIBUTE_UNUSED_ = \
GTEST_TYPED_TEST_CASE_P_STATE_(CaseName).VerifyRegisteredTestNames(\
GTEST_TYPED_TEST_CASE_P_STATE_(CaseName).VerifyRegisteredTestNames( \
__FILE__, __LINE__, #__VA_ARGS__)

// The 'Types' template argument below must have spaces around it
Expand Down
68 changes: 34 additions & 34 deletions googletest/include/gtest/internal/gtest-param-util-generated.h
Original file line number Diff line number Diff line change
Expand Up @@ -3203,7 +3203,7 @@ class CartesianProductGenerator2
virtual ParamIteratorInterface<ParamType>* Clone() const {
return new Iterator(*this);
}
virtual const ParamType* Current() const { return &current_value_; }
virtual const ParamType* Current() const { return current_value_.get(); }
virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const {
// Having the same base generator guarantees that the other
// iterator is of the same type and we can downcast.
Expand Down Expand Up @@ -3235,7 +3235,7 @@ class CartesianProductGenerator2

void ComputeCurrentValue() {
if (!AtEnd())
current_value_ = ParamType(*current1_, *current2_);
current_value_.reset(new ParamType(*current1_, *current2_));
}
bool AtEnd() const {
// We must report iterator past the end of the range when either of the
Expand All @@ -3257,7 +3257,7 @@ class CartesianProductGenerator2
const typename ParamGenerator<T2>::iterator begin2_;
const typename ParamGenerator<T2>::iterator end2_;
typename ParamGenerator<T2>::iterator current2_;
ParamType current_value_;
linked_ptr<ParamType> current_value_;
}; // class CartesianProductGenerator2::Iterator

// No implementation - assignment is unsupported.
Expand Down Expand Up @@ -3326,7 +3326,7 @@ class CartesianProductGenerator3
virtual ParamIteratorInterface<ParamType>* Clone() const {
return new Iterator(*this);
}
virtual const ParamType* Current() const { return &current_value_; }
virtual const ParamType* Current() const { return current_value_.get(); }
virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const {
// Having the same base generator guarantees that the other
// iterator is of the same type and we can downcast.
Expand Down Expand Up @@ -3362,7 +3362,7 @@ class CartesianProductGenerator3

void ComputeCurrentValue() {
if (!AtEnd())
current_value_ = ParamType(*current1_, *current2_, *current3_);
current_value_.reset(new ParamType(*current1_, *current2_, *current3_));
}
bool AtEnd() const {
// We must report iterator past the end of the range when either of the
Expand All @@ -3388,7 +3388,7 @@ class CartesianProductGenerator3
const typename ParamGenerator<T3>::iterator begin3_;
const typename ParamGenerator<T3>::iterator end3_;
typename ParamGenerator<T3>::iterator current3_;
ParamType current_value_;
linked_ptr<ParamType> current_value_;
}; // class CartesianProductGenerator3::Iterator

// No implementation - assignment is unsupported.
Expand Down Expand Up @@ -3467,7 +3467,7 @@ class CartesianProductGenerator4
virtual ParamIteratorInterface<ParamType>* Clone() const {
return new Iterator(*this);
}
virtual const ParamType* Current() const { return &current_value_; }
virtual const ParamType* Current() const { return current_value_.get(); }
virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const {
// Having the same base generator guarantees that the other
// iterator is of the same type and we can downcast.
Expand Down Expand Up @@ -3507,8 +3507,8 @@ class CartesianProductGenerator4

void ComputeCurrentValue() {
if (!AtEnd())
current_value_ = ParamType(*current1_, *current2_, *current3_,
*current4_);
current_value_.reset(new ParamType(*current1_, *current2_, *current3_,
*current4_));
}
bool AtEnd() const {
// We must report iterator past the end of the range when either of the
Expand Down Expand Up @@ -3538,7 +3538,7 @@ class CartesianProductGenerator4
const typename ParamGenerator<T4>::iterator begin4_;
const typename ParamGenerator<T4>::iterator end4_;
typename ParamGenerator<T4>::iterator current4_;
ParamType current_value_;
linked_ptr<ParamType> current_value_;
}; // class CartesianProductGenerator4::Iterator

// No implementation - assignment is unsupported.
Expand Down Expand Up @@ -3625,7 +3625,7 @@ class CartesianProductGenerator5
virtual ParamIteratorInterface<ParamType>* Clone() const {
return new Iterator(*this);
}
virtual const ParamType* Current() const { return &current_value_; }
virtual const ParamType* Current() const { return current_value_.get(); }
virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const {
// Having the same base generator guarantees that the other
// iterator is of the same type and we can downcast.
Expand Down Expand Up @@ -3669,8 +3669,8 @@ class CartesianProductGenerator5

void ComputeCurrentValue() {
if (!AtEnd())
current_value_ = ParamType(*current1_, *current2_, *current3_,
*current4_, *current5_);
current_value_.reset(new ParamType(*current1_, *current2_, *current3_,
*current4_, *current5_));
}
bool AtEnd() const {
// We must report iterator past the end of the range when either of the
Expand Down Expand Up @@ -3704,7 +3704,7 @@ class CartesianProductGenerator5
const typename ParamGenerator<T5>::iterator begin5_;
const typename ParamGenerator<T5>::iterator end5_;
typename ParamGenerator<T5>::iterator current5_;
ParamType current_value_;
linked_ptr<ParamType> current_value_;
}; // class CartesianProductGenerator5::Iterator

// No implementation - assignment is unsupported.
Expand Down Expand Up @@ -3802,7 +3802,7 @@ class CartesianProductGenerator6
virtual ParamIteratorInterface<ParamType>* Clone() const {
return new Iterator(*this);
}
virtual const ParamType* Current() const { return &current_value_; }
virtual const ParamType* Current() const { return current_value_.get(); }
virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const {
// Having the same base generator guarantees that the other
// iterator is of the same type and we can downcast.
Expand Down Expand Up @@ -3850,8 +3850,8 @@ class CartesianProductGenerator6

void ComputeCurrentValue() {
if (!AtEnd())
current_value_ = ParamType(*current1_, *current2_, *current3_,
*current4_, *current5_, *current6_);
current_value_.reset(new ParamType(*current1_, *current2_, *current3_,
*current4_, *current5_, *current6_));
}
bool AtEnd() const {
// We must report iterator past the end of the range when either of the
Expand Down Expand Up @@ -3889,7 +3889,7 @@ class CartesianProductGenerator6
const typename ParamGenerator<T6>::iterator begin6_;
const typename ParamGenerator<T6>::iterator end6_;
typename ParamGenerator<T6>::iterator current6_;
ParamType current_value_;
linked_ptr<ParamType> current_value_;
}; // class CartesianProductGenerator6::Iterator

// No implementation - assignment is unsupported.
Expand Down Expand Up @@ -3996,7 +3996,7 @@ class CartesianProductGenerator7
virtual ParamIteratorInterface<ParamType>* Clone() const {
return new Iterator(*this);
}
virtual const ParamType* Current() const { return &current_value_; }
virtual const ParamType* Current() const { return current_value_.get(); }
virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const {
// Having the same base generator guarantees that the other
// iterator is of the same type and we can downcast.
Expand Down Expand Up @@ -4048,8 +4048,8 @@ class CartesianProductGenerator7

void ComputeCurrentValue() {
if (!AtEnd())
current_value_ = ParamType(*current1_, *current2_, *current3_,
*current4_, *current5_, *current6_, *current7_);
current_value_.reset(new ParamType(*current1_, *current2_, *current3_,
*current4_, *current5_, *current6_, *current7_));
}
bool AtEnd() const {
// We must report iterator past the end of the range when either of the
Expand Down Expand Up @@ -4091,7 +4091,7 @@ class CartesianProductGenerator7
const typename ParamGenerator<T7>::iterator begin7_;
const typename ParamGenerator<T7>::iterator end7_;
typename ParamGenerator<T7>::iterator current7_;
ParamType current_value_;
linked_ptr<ParamType> current_value_;
}; // class CartesianProductGenerator7::Iterator

// No implementation - assignment is unsupported.
Expand Down Expand Up @@ -4209,7 +4209,7 @@ class CartesianProductGenerator8
virtual ParamIteratorInterface<ParamType>* Clone() const {
return new Iterator(*this);
}
virtual const ParamType* Current() const { return &current_value_; }
virtual const ParamType* Current() const { return current_value_.get(); }
virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const {
// Having the same base generator guarantees that the other
// iterator is of the same type and we can downcast.
Expand Down Expand Up @@ -4265,8 +4265,8 @@ class CartesianProductGenerator8

void ComputeCurrentValue() {
if (!AtEnd())
current_value_ = ParamType(*current1_, *current2_, *current3_,
*current4_, *current5_, *current6_, *current7_, *current8_);
current_value_.reset(new ParamType(*current1_, *current2_, *current3_,
*current4_, *current5_, *current6_, *current7_, *current8_));
}
bool AtEnd() const {
// We must report iterator past the end of the range when either of the
Expand Down Expand Up @@ -4312,7 +4312,7 @@ class CartesianProductGenerator8
const typename ParamGenerator<T8>::iterator begin8_;
const typename ParamGenerator<T8>::iterator end8_;
typename ParamGenerator<T8>::iterator current8_;
ParamType current_value_;
linked_ptr<ParamType> current_value_;
}; // class CartesianProductGenerator8::Iterator

// No implementation - assignment is unsupported.
Expand Down Expand Up @@ -4438,7 +4438,7 @@ class CartesianProductGenerator9
virtual ParamIteratorInterface<ParamType>* Clone() const {
return new Iterator(*this);
}
virtual const ParamType* Current() const { return &current_value_; }
virtual const ParamType* Current() const { return current_value_.get(); }
virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const {
// Having the same base generator guarantees that the other
// iterator is of the same type and we can downcast.
Expand Down Expand Up @@ -4498,9 +4498,9 @@ class CartesianProductGenerator9

void ComputeCurrentValue() {
if (!AtEnd())
current_value_ = ParamType(*current1_, *current2_, *current3_,
current_value_.reset(new ParamType(*current1_, *current2_, *current3_,
*current4_, *current5_, *current6_, *current7_, *current8_,
*current9_);
*current9_));
}
bool AtEnd() const {
// We must report iterator past the end of the range when either of the
Expand Down Expand Up @@ -4550,7 +4550,7 @@ class CartesianProductGenerator9
const typename ParamGenerator<T9>::iterator begin9_;
const typename ParamGenerator<T9>::iterator end9_;
typename ParamGenerator<T9>::iterator current9_;
ParamType current_value_;
linked_ptr<ParamType> current_value_;
}; // class CartesianProductGenerator9::Iterator

// No implementation - assignment is unsupported.
Expand Down Expand Up @@ -4685,7 +4685,7 @@ class CartesianProductGenerator10
virtual ParamIteratorInterface<ParamType>* Clone() const {
return new Iterator(*this);
}
virtual const ParamType* Current() const { return &current_value_; }
virtual const ParamType* Current() const { return current_value_.get(); }
virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const {
// Having the same base generator guarantees that the other
// iterator is of the same type and we can downcast.
Expand Down Expand Up @@ -4749,9 +4749,9 @@ class CartesianProductGenerator10

void ComputeCurrentValue() {
if (!AtEnd())
current_value_ = ParamType(*current1_, *current2_, *current3_,
current_value_.reset(new ParamType(*current1_, *current2_, *current3_,
*current4_, *current5_, *current6_, *current7_, *current8_,
*current9_, *current10_);
*current9_, *current10_));
}
bool AtEnd() const {
// We must report iterator past the end of the range when either of the
Expand Down Expand Up @@ -4805,7 +4805,7 @@ class CartesianProductGenerator10
const typename ParamGenerator<T10>::iterator begin10_;
const typename ParamGenerator<T10>::iterator end10_;
typename ParamGenerator<T10>::iterator current10_;
ParamType current_value_;
linked_ptr<ParamType> current_value_;
}; // class CartesianProductGenerator10::Iterator

// No implementation - assignment is unsupported.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ $for k [[
virtual ParamIteratorInterface<ParamType>* Clone() const {
return new Iterator(*this);
}
virtual const ParamType* Current() const { return &current_value_; }
virtual const ParamType* Current() const { return current_value_.get(); }
virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const {
// Having the same base generator guarantees that the other
// iterator is of the same type and we can downcast.
Expand Down Expand Up @@ -192,7 +192,7 @@ $for k [[

void ComputeCurrentValue() {
if (!AtEnd())
current_value_ = ParamType($for j, [[*current$(j)_]]);
current_value_.reset(new ParamType($for j, [[*current$(j)_]]));
}
bool AtEnd() const {
// We must report iterator past the end of the range when either of the
Expand All @@ -217,7 +217,7 @@ $for j [[
typename ParamGenerator<T$j>::iterator current$(j)_;
]]

ParamType current_value_;
linked_ptr<ParamType> current_value_;
}; // class CartesianProductGenerator$i::Iterator

// No implementation - assignment is unsupported.
Expand Down

0 comments on commit 6a26e47

Please sign in to comment.