34 #ifndef GOOGLETEST_INCLUDE_GTEST_GTEST_PARAM_TEST_H_
35 #define GOOGLETEST_INCLUDE_GTEST_GTEST_PARAM_TEST_H_
60 TEST_P(FooTest, DoesBlah) {
67 TEST_P(FooTest, HasBlahBlah) {
97 Values(
"meeny",
"miny",
"moe"));
118 const char* pets[] = {
"cat",
"dog"};
163 TEST_F(BaseTest, HasFoo) {
167 TEST_P(DerivedTest, DoesBlah) {
177 #include "gtest/internal/gtest-internal.h"
178 #include "gtest/internal/gtest-param-util.h"
179 #include "gtest/internal/gtest-port.h"
225 template <
typename T,
typename IncrementT>
231 template <
typename T>
233 return Range(start, end, 1);
291 template <
typename ForwardIterator>
292 internal::ParamGenerator<
293 typename std::iterator_traits<ForwardIterator>::value_type>
294 ValuesIn(ForwardIterator begin, ForwardIterator end) {
295 typedef typename std::iterator_traits<ForwardIterator>::value_type ParamType;
300 template <
typename T,
size_t N>
305 template <
class Container>
307 const Container& container) {
308 return ValuesIn(container.begin(), container.end());
331 template <
typename... T>
357 return Values(
false,
true);
404 template <
typename... Generator>
409 #define TEST_P(test_suite_name, test_name) \
410 class GTEST_TEST_CLASS_NAME_(test_suite_name, test_name) \
411 : public test_suite_name { \
413 GTEST_TEST_CLASS_NAME_(test_suite_name, test_name)() {} \
414 void TestBody() override; \
417 static int AddToRegistry() { \
418 ::testing::UnitTest::GetInstance() \
419 ->parameterized_test_registry() \
420 .GetTestSuitePatternHolder<test_suite_name>( \
421 GTEST_STRINGIFY_(test_suite_name), \
422 ::testing::internal::CodeLocation(__FILE__, __LINE__)) \
424 GTEST_STRINGIFY_(test_suite_name), GTEST_STRINGIFY_(test_name), \
425 new ::testing::internal::TestMetaFactory<GTEST_TEST_CLASS_NAME_( \
426 test_suite_name, test_name)>(), \
427 ::testing::internal::CodeLocation(__FILE__, __LINE__)); \
430 static int gtest_registering_dummy_ GTEST_ATTRIBUTE_UNUSED_; \
431 GTEST_DISALLOW_COPY_AND_ASSIGN_(GTEST_TEST_CLASS_NAME_(test_suite_name, \
434 int GTEST_TEST_CLASS_NAME_(test_suite_name, \
435 test_name)::gtest_registering_dummy_ = \
436 GTEST_TEST_CLASS_NAME_(test_suite_name, test_name)::AddToRegistry(); \
437 void GTEST_TEST_CLASS_NAME_(test_suite_name, test_name)::TestBody()
452 #define GTEST_EXPAND_(arg) arg
453 #define GTEST_GET_FIRST_(first, ...) first
454 #define GTEST_GET_SECOND_(first, second, ...) second
456 #define INSTANTIATE_TEST_SUITE_P(prefix, test_suite_name, ...) \
457 static ::testing::internal::ParamGenerator<test_suite_name::ParamType> \
458 gtest_##prefix##test_suite_name##_EvalGenerator_() { \
459 return GTEST_EXPAND_(GTEST_GET_FIRST_(__VA_ARGS__, DUMMY_PARAM_)); \
461 static ::std::string gtest_##prefix##test_suite_name##_EvalGenerateName_( \
462 const ::testing::TestParamInfo<test_suite_name::ParamType>& info) { \
463 if (::testing::internal::AlwaysFalse()) { \
464 ::testing::internal::TestNotEmpty(GTEST_EXPAND_(GTEST_GET_SECOND_( \
466 ::testing::internal::DefaultParamName<test_suite_name::ParamType>, \
468 auto t = std::make_tuple(__VA_ARGS__); \
469 static_assert(std::tuple_size<decltype(t)>::value <= 2, \
472 return ((GTEST_EXPAND_(GTEST_GET_SECOND_( \
474 ::testing::internal::DefaultParamName<test_suite_name::ParamType>, \
475 DUMMY_PARAM_))))(info); \
477 static int gtest_##prefix##test_suite_name##_dummy_ \
478 GTEST_ATTRIBUTE_UNUSED_ = \
479 ::testing::UnitTest::GetInstance() \
480 ->parameterized_test_registry() \
481 .GetTestSuitePatternHolder<test_suite_name>( \
482 GTEST_STRINGIFY_(test_suite_name), \
483 ::testing::internal::CodeLocation(__FILE__, __LINE__)) \
484 ->AddTestSuiteInstantiation( \
485 GTEST_STRINGIFY_(prefix), \
486 >est_##prefix##test_suite_name##_EvalGenerator_, \
487 >est_##prefix##test_suite_name##_EvalGenerateName_, \
492 #define GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(T) \
493 namespace gtest_do_not_use_outside_namespace_scope {} \
494 static const ::testing::internal::MarkAsIgnored gtest_allow_ignore_##T( \
498 #ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_
499 #define INSTANTIATE_TEST_CASE_P \
500 static_assert(::testing::internal::InstantiateTestCase_P_IsDeprecated(), \
502 INSTANTIATE_TEST_SUITE_P
Definition: cmake-build-debug/googletest-src/googletest/include/gtest/gtest.h:414
Definition: cmake-build-debug/googletest-src/googletest/include/gtest/gtest.h:1881
Definition: cmake-build-debug/googletest-src/googletest/include/gtest/gtest.h:1846
Definition: cmake-build-debug/googletest-src/googletest/include/gtest/internal/gtest-param-util.h:931
Definition: cmake-build-release/googletest-src/googletest/include/gtest/internal/gtest-param-util.h:183
Definition: cmake-build-debug/googletest-src/googletest/include/gtest/internal/gtest-param-util.h:207
Definition: cmake-build-debug/googletest-src/googletest/include/gtest/internal/gtest-param-util.h:792
Definition: cmake-build-debug/googletest-src/googletest/include/gtest/internal/gtest-param-util.h:292
#define TEST_P(test_suite_name, test_name)
Definition: cmake-build-debug/googletest-src/googletest/include/gtest/gtest-param-test.h:409
#define INSTANTIATE_TEST_SUITE_P(prefix, test_suite_name,...)
Definition: cmake-build-debug/googletest-src/googletest/include/gtest/gtest-param-test.h:456
#define TEST_F(test_fixture, test_name)
Definition: cmake-build-debug/googletest-src/googletest/include/gtest/gtest.h:2365
#define EXPECT_TRUE(condition)
Definition: cmake-build-debug/googletest-src/googletest/include/gtest/gtest.h:1965
Definition: cmake-build-debug/googletest-src/googlemock/include/gmock/gmock-actions.h:154
internal::ParamGenerator< bool > Bool()
Definition: cmake-build-debug/googletest-src/googletest/include/gtest/gtest-param-test.h:356
internal::ParamGenerator< typename std::iterator_traits< ForwardIterator >::value_type > ValuesIn(ForwardIterator begin, ForwardIterator end)
Definition: cmake-build-debug/googletest-src/googletest/include/gtest/gtest-param-test.h:294
internal::ParamGenerator< T > Range(T start, T end, IncrementT step)
Definition: cmake-build-debug/googletest-src/googletest/include/gtest/gtest-param-test.h:226
internal::ParamGenerator< typename Container::value_type > ValuesIn(const Container &container)
Definition: cmake-build-debug/googletest-src/googletest/include/gtest/gtest-param-test.h:306
internal::CartesianProductHolder< Generator... > Combine(const Generator &... g)
Definition: cmake-build-debug/googletest-src/googletest/include/gtest/gtest-param-test.h:405
internal::ValueArray< T... > Values(T... v)
Definition: cmake-build-debug/googletest-src/googletest/include/gtest/gtest-param-test.h:332