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) {
228 template <
typename T,
typename IncrementT>
234 template <
typename T>
236 return Range(start, end, 1);
294 template <
typename ForwardIterator>
295 internal::ParamGenerator<
296 typename std::iterator_traits<ForwardIterator>::value_type>
297 ValuesIn(ForwardIterator begin, ForwardIterator end) {
298 typedef typename std::iterator_traits<ForwardIterator>::value_type ParamType;
303 template <
typename T,
size_t N>
308 template <
class 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 void TestBody() override; \
422 static int AddToRegistry() { \
423 ::testing::UnitTest::GetInstance() \
424 ->parameterized_test_registry() \
425 .GetTestSuitePatternHolder<test_suite_name>( \
426 GTEST_STRINGIFY_(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)>(), \
432 ::testing::internal::CodeLocation(__FILE__, __LINE__)); \
435 static int gtest_registering_dummy_ GTEST_ATTRIBUTE_UNUSED_; \
436 GTEST_DISALLOW_COPY_AND_ASSIGN_(GTEST_TEST_CLASS_NAME_(test_suite_name, \
439 int GTEST_TEST_CLASS_NAME_(test_suite_name, \
440 test_name)::gtest_registering_dummy_ = \
441 GTEST_TEST_CLASS_NAME_(test_suite_name, test_name)::AddToRegistry(); \
442 void GTEST_TEST_CLASS_NAME_(test_suite_name, test_name)::TestBody()
457 #define GTEST_EXPAND_(arg) arg
458 #define GTEST_GET_FIRST_(first, ...) first
459 #define GTEST_GET_SECOND_(first, second, ...) second
461 #define INSTANTIATE_TEST_SUITE_P(prefix, test_suite_name, ...) \
462 static ::testing::internal::ParamGenerator<test_suite_name::ParamType> \
463 gtest_##prefix##test_suite_name##_EvalGenerator_() { \
464 return GTEST_EXPAND_(GTEST_GET_FIRST_(__VA_ARGS__, DUMMY_PARAM_)); \
466 static ::std::string gtest_##prefix##test_suite_name##_EvalGenerateName_( \
467 const ::testing::TestParamInfo<test_suite_name::ParamType>& info) { \
468 if (::testing::internal::AlwaysFalse()) { \
469 ::testing::internal::TestNotEmpty(GTEST_EXPAND_(GTEST_GET_SECOND_( \
471 ::testing::internal::DefaultParamName<test_suite_name::ParamType>, \
473 auto t = std::make_tuple(__VA_ARGS__); \
474 static_assert(std::tuple_size<decltype(t)>::value <= 2, \
477 return ((GTEST_EXPAND_(GTEST_GET_SECOND_( \
479 ::testing::internal::DefaultParamName<test_suite_name::ParamType>, \
480 DUMMY_PARAM_))))(info); \
482 static int gtest_##prefix##test_suite_name##_dummy_ \
483 GTEST_ATTRIBUTE_UNUSED_ = \
484 ::testing::UnitTest::GetInstance() \
485 ->parameterized_test_registry() \
486 .GetTestSuitePatternHolder<test_suite_name>( \
487 GTEST_STRINGIFY_(test_suite_name), \
488 ::testing::internal::CodeLocation(__FILE__, __LINE__)) \
489 ->AddTestSuiteInstantiation( \
490 GTEST_STRINGIFY_(prefix), \
491 >est_##prefix##test_suite_name##_EvalGenerator_, \
492 >est_##prefix##test_suite_name##_EvalGenerateName_, \
497 #define GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(T) \
498 namespace gtest_do_not_use_outside_namespace_scope {} \
499 static const ::testing::internal::MarkAsIgnored gtest_allow_ignore_##T( \
503 #ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_
504 #define INSTANTIATE_TEST_CASE_P \
505 static_assert(::testing::internal::InstantiateTestCase_P_IsDeprecated(), \
507 INSTANTIATE_TEST_SUITE_P
508 #endif // GTEST_REMOVE_LEGACY_TEST_CASEAPI_
512 #endif // GTEST_INCLUDE_GTEST_GTEST_PARAM_TEST_H_
internal::ValueArray< T...> Values(T...v)
internal::ParamGenerator< bool > Bool()
#define TEST_F(test_fixture, test_name)
internal::ParamGenerator< T > Range(T start, T end, IncrementT step)
internal::ParamGenerator< typename std::iterator_traits< ForwardIterator >::value_type > ValuesIn(ForwardIterator begin, ForwardIterator end)
internal::CartesianProductHolder< Generator...> Combine(const Generator &...g)
ADVar foo(double d, ADVar x, ADVar y)
#define TEST_P(test_suite_name, test_name)
#define EXPECT_TRUE(condition)
#define INSTANTIATE_TEST_SUITE_P(prefix, test_suite_name,...)