36 #ifndef GTEST_INCLUDE_GTEST_GTEST_PARAM_TEST_H_ 37 #define GTEST_INCLUDE_GTEST_GTEST_PARAM_TEST_H_ 63 TEST_P(FooTest, DoesBlah) {
70 TEST_P(FooTest, HasBlahBlah) {
100 Values(
"meeny",
"miny",
"moe"));
121 const char* pets[] = {
"cat",
"dog"};
166 TEST_F(BaseTest, HasFoo) {
170 TEST_P(DerivedTest, DoesBlah) {
227 template <
typename T,
typename IncrementT>
233 template <
typename T>
235 return Range(start, end, 1);
293 template <
typename ForwardIterator>
295 typename ::testing::internal::IteratorTraits<ForwardIterator>::value_type>
296 ValuesIn(ForwardIterator begin, ForwardIterator end) {
297 typedef typename ::testing::internal::IteratorTraits<ForwardIterator>
298 ::value_type ParamType;
303 template <
typename T,
size_t N>
308 template <
class Container>
310 const Container& container) {
311 return ValuesIn(container.begin(), container.end());
334 template <
typename... T>
360 return Values(
false,
true);
409 template <
typename... Generator>
414 #define TEST_P(test_suite_name, test_name) \ 415 class GTEST_TEST_CLASS_NAME_(test_suite_name, test_name) \ 416 : public test_suite_name { \ 418 GTEST_TEST_CLASS_NAME_(test_suite_name, test_name)() {} \ 419 virtual void TestBody(); \ 422 static int AddToRegistry() { \ 423 ::testing::UnitTest::GetInstance() \ 424 ->parameterized_test_registry() \ 425 .GetTestSuitePatternHolder<test_suite_name>( \ 427 ::testing::internal::CodeLocation(__FILE__, __LINE__)) \ 429 GTEST_STRINGIFY_(test_suite_name), GTEST_STRINGIFY_(test_name), \ 430 new ::testing::internal::TestMetaFactory<GTEST_TEST_CLASS_NAME_( \ 431 test_suite_name, test_name)>()); \ 434 static int gtest_registering_dummy_ GTEST_ATTRIBUTE_UNUSED_; \ 435 GTEST_DISALLOW_COPY_AND_ASSIGN_(GTEST_TEST_CLASS_NAME_(test_suite_name, \ 438 int GTEST_TEST_CLASS_NAME_(test_suite_name, \ 439 test_name)::gtest_registering_dummy_ = \ 440 GTEST_TEST_CLASS_NAME_(test_suite_name, test_name)::AddToRegistry(); \ 441 void GTEST_TEST_CLASS_NAME_(test_suite_name, test_name)::TestBody() 456 #define GTEST_EXPAND_(arg) arg 457 #define GTEST_GET_FIRST_(first, ...) first 458 #define GTEST_GET_SECOND_(first, second, ...) second 460 #define INSTANTIATE_TEST_SUITE_P(prefix, test_suite_name, ...) \ 461 static ::testing::internal::ParamGenerator<test_suite_name::ParamType> \ 462 gtest_##prefix##test_suite_name##_EvalGenerator_() { \ 463 return GTEST_EXPAND_(GTEST_GET_FIRST_(__VA_ARGS__, DUMMY_PARAM_)); \ 465 static ::std::string gtest_##prefix##test_suite_name##_EvalGenerateName_( \ 466 const ::testing::TestParamInfo<test_suite_name::ParamType>& info) { \ 467 if (::testing::internal::AlwaysFalse()) { \ 468 ::testing::internal::TestNotEmpty(GTEST_EXPAND_(GTEST_GET_SECOND_( \ 470 ::testing::internal::DefaultParamName<test_suite_name::ParamType>, \ 472 auto t = std::make_tuple(__VA_ARGS__); \ 473 static_assert(std::tuple_size<decltype(t)>::value <= 2, \ 476 return ((GTEST_EXPAND_(GTEST_GET_SECOND_( \ 478 ::testing::internal::DefaultParamName<test_suite_name::ParamType>, \ 479 DUMMY_PARAM_))))(info); \ 481 static int gtest_##prefix##test_suite_name##_dummy_ \ 482 GTEST_ATTRIBUTE_UNUSED_ = \ 483 ::testing::UnitTest::GetInstance() \ 484 ->parameterized_test_registry() \ 485 .GetTestSuitePatternHolder<test_suite_name>( \ 487 ::testing::internal::CodeLocation(__FILE__, __LINE__)) \ 488 ->AddTestSuiteInstantiation( \ 489 #prefix, >est_##prefix##test_suite_name##_EvalGenerator_, \ 490 >est_##prefix##test_suite_name##_EvalGenerateName_, \ 494 #ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_ 495 #define INSTANTIATE_TEST_CASE_P \ 496 static_assert(::testing::internal::InstantiateTestCase_P_IsDeprecated(), \ 498 INSTANTIATE_TEST_SUITE_P 499 #endif // GTEST_REMOVE_LEGACY_TEST_CASEAPI_ 503 #endif // GTEST_INCLUDE_GTEST_GTEST_PARAM_TEST_H_ internal::ValueArray< T... > Values(T...v)
Definition: gtest-param-test.h:335
Definition: gmock-actions.h:59
Definition: gtest-param-util.h:205
Definition: gtest-param-util.h:290
internal::ParamGenerator< bool > Bool()
Definition: gtest-param-test.h:359
#define TEST_F(test_fixture, test_name)
Definition: gtest.h:2348
internal::CartesianProductHolder< Generator... > Combine(const Generator &...g)
Definition: gtest-param-test.h:410
TEST_P(CodeLocationForTESTP, Verify)
Definition: gtest_unittest.cc:5342
INSTANTIATE_TEST_SUITE_P(, CodeLocationForTESTP, Values(0))
internal::ParamGenerator< typename Container::value_type > ValuesIn(const Container &container)
Definition: gtest-param-test.h:309
Definition: gtest-param-util.h:729
#define TEST_P(test_suite_name, test_name)
Definition: gtest-param-test.h:414
Definition: gtest-param-util.h:864
Definition: googletest-output-test_.cc:538
internal::ParamGenerator< T > Range(T start, T end)
Definition: gtest-param-test.h:234
#define EXPECT_TRUE(condition)
Definition: gtest.h:1948
Definition: gtest-param-util.h:86
internal::ParamGenerator< typename::testing::internal::IteratorTraits< ForwardIterator >::value_type > ValuesIn(ForwardIterator begin, ForwardIterator end)
Definition: gtest-param-test.h:296