1// Copyright 2008, Google Inc.
2// All rights reserved.
3//
4// Redistribution and use in source and binary forms, with or without
5// modification, are permitted provided that the following conditions are
6// met:
7//
8// * Redistributions of source code must retain the above copyright
9// notice, this list of conditions and the following disclaimer.
10// * Redistributions in binary form must reproduce the above
11// copyright notice, this list of conditions and the following disclaimer
12// in the documentation and/or other materials provided with the
13// distribution.
14// * Neither the name of Google Inc. nor the names of its
15// contributors may be used to endorse or promote products derived from
16// this software without specific prior written permission.
17//
18// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
30// Macros and functions for implementing parameterized tests
31// in Google C++ Testing and Mocking Framework (Google Test)
32
33// IWYU pragma: private, include "gtest/gtest.h"
34// IWYU pragma: friend gtest/.*
35// IWYU pragma: friend gmock/.*
36
37#ifndef GOOGLETEST_INCLUDE_GTEST_GTEST_PARAM_TEST_H_
38#define GOOGLETEST_INCLUDE_GTEST_GTEST_PARAM_TEST_H_
39
40// Value-parameterized tests allow you to test your code with different
41// parameters without writing multiple copies of the same test.
42//
43// Here is how you use value-parameterized tests:
44
45#if 0
46
47// To write value-parameterized tests, first you should define a fixture
48// class. It is usually derived from testing::TestWithParam<T> (see below for
49// another inheritance scheme that's sometimes useful in more complicated
50// class hierarchies), where the type of your parameter values.
51// TestWithParam<T> is itself derived from testing::Test. T can be any
52// copyable type. If it's a raw pointer, you are responsible for managing the
53// lifespan of the pointed values.
54
55class FooTest : public ::testing::TestWithParam<const char*> {
56 // You can implement all the usual class fixture members here.
57};
58
59// Then, use the TEST_P macro to define as many parameterized tests
60// for this fixture as you want. The _P suffix is for "parameterized"
61// or "pattern", whichever you prefer to think.
62
63TEST_P(FooTest, DoesBlah) {
64 // Inside a test, access the test parameter with the GetParam() method
65 // of the TestWithParam<T> class:
66 EXPECT_TRUE(foo.Blah(GetParam()));
67 ...
68}
69
70TEST_P(FooTest, HasBlahBlah) {
71 ...
72}
73
74// Finally, you can use INSTANTIATE_TEST_SUITE_P to instantiate the test
75// case with any set of parameters you want. Google Test defines a number
76// of functions for generating test parameters. They return what we call
77// (surprise!) parameter generators. Here is a summary of them, which
78// are all in the testing namespace:
79//
80//
81// Range(begin, end [, step]) - Yields values {begin, begin+step,
82// begin+step+step, ...}. The values do not
83// include end. step defaults to 1.
84// Values(v1, v2, ..., vN) - Yields values {v1, v2, ..., vN}.
85// ValuesIn(container) - Yields values from a C-style array, an STL
86// ValuesIn(begin,end) container, or an iterator range [begin, end).
87// Bool() - Yields sequence {false, true}.
88// Combine(g1, g2, ..., gN) - Yields all combinations (the Cartesian product
89// for the math savvy) of the values generated
90// by the N generators.
91//
92// For more details, see comments at the definitions of these functions below
93// in this file.
94//
95// The following statement will instantiate tests from the FooTest test suite
96// each with parameter values "meeny", "miny", and "moe".
97
98INSTANTIATE_TEST_SUITE_P(InstantiationName,
99 FooTest,
100 Values("meeny", "miny", "moe"));
101
102// To distinguish different instances of the pattern, (yes, you
103// can instantiate it more than once) the first argument to the
104// INSTANTIATE_TEST_SUITE_P macro is a prefix that will be added to the
105// actual test suite name. Remember to pick unique prefixes for different
106// instantiations. The tests from the instantiation above will have
107// these names:
108//
109// * InstantiationName/FooTest.DoesBlah/0 for "meeny"
110// * InstantiationName/FooTest.DoesBlah/1 for "miny"
111// * InstantiationName/FooTest.DoesBlah/2 for "moe"
112// * InstantiationName/FooTest.HasBlahBlah/0 for "meeny"
113// * InstantiationName/FooTest.HasBlahBlah/1 for "miny"
114// * InstantiationName/FooTest.HasBlahBlah/2 for "moe"
115//
116// You can use these names in --gtest_filter.
117//
118// This statement will instantiate all tests from FooTest again, each
119// with parameter values "cat" and "dog":
120
121const char* pets[] = {"cat", "dog"};
122INSTANTIATE_TEST_SUITE_P(AnotherInstantiationName, FooTest, ValuesIn(pets));
123
124// The tests from the instantiation above will have these names:
125//
126// * AnotherInstantiationName/FooTest.DoesBlah/0 for "cat"
127// * AnotherInstantiationName/FooTest.DoesBlah/1 for "dog"
128// * AnotherInstantiationName/FooTest.HasBlahBlah/0 for "cat"
129// * AnotherInstantiationName/FooTest.HasBlahBlah/1 for "dog"
130//
131// Please note that INSTANTIATE_TEST_SUITE_P will instantiate all tests
132// in the given test suite, whether their definitions come before or
133// AFTER the INSTANTIATE_TEST_SUITE_P statement.
134//
135// Please also note that generator expressions (including parameters to the
136// generators) are evaluated in InitGoogleTest(), after main() has started.
137// This allows the user on one hand, to adjust generator parameters in order
138// to dynamically determine a set of tests to run and on the other hand,
139// give the user a chance to inspect the generated tests with Google Test
140// reflection API before RUN_ALL_TESTS() is executed.
141//
142// You can see samples/sample7_unittest.cc and samples/sample8_unittest.cc
143// for more examples.
144//
145// In the future, we plan to publish the API for defining new parameter
146// generators. But for now this interface remains part of the internal
147// implementation and is subject to change.
148//
149//
150// A parameterized test fixture must be derived from testing::Test and from
151// testing::WithParamInterface<T>, where T is the type of the parameter
152// values. Inheriting from TestWithParam<T> satisfies that requirement because
153// TestWithParam<T> inherits from both Test and WithParamInterface. In more
154// complicated hierarchies, however, it is occasionally useful to inherit
155// separately from Test and WithParamInterface. For example:
156
157class BaseTest : public ::testing::Test {
158 // You can inherit all the usual members for a non-parameterized test
159 // fixture here.
160};
161
162class DerivedTest : public BaseTest, public ::testing::WithParamInterface<int> {
163 // The usual test fixture members go here too.
164};
165
166TEST_F(BaseTest, HasFoo) {
167 // This is an ordinary non-parameterized test.
168}
169
170TEST_P(DerivedTest, DoesBlah) {
171 // GetParam works just the same here as if you inherit from TestWithParam.
172 EXPECT_TRUE(foo.Blah(GetParam()));
173}
174
175#endif // 0
176
177#include <functional>
178#include <iterator>
179#include <utility>
180
181#include "gtest/internal/gtest-internal.h"
182#include "gtest/internal/gtest-param-util.h" // IWYU pragma: export
183#include "gtest/internal/gtest-port.h"
184
185namespace testing {
186
187// Functions producing parameter generators.
188//
189// Google Test uses these generators to produce parameters for value-
190// parameterized tests. When a parameterized test suite is instantiated
191// with a particular generator, Google Test creates and runs tests
192// for each element in the sequence produced by the generator.
193//
194// In the following sample, tests from test suite FooTest are instantiated
195// each three times with parameter values 3, 5, and 8:
196//
197// class FooTest : public TestWithParam<int> { ... };
198//
199// TEST_P(FooTest, TestThis) {
200// }
201// TEST_P(FooTest, TestThat) {
202// }
203// INSTANTIATE_TEST_SUITE_P(TestSequence, FooTest, Values(3, 5, 8));
204//
205
206// Range() returns generators providing sequences of values in a range.
207//
208// Synopsis:
209// Range(start, end)
210// - returns a generator producing a sequence of values {start, start+1,
211// start+2, ..., }.
212// Range(start, end, step)
213// - returns a generator producing a sequence of values {start, start+step,
214// start+step+step, ..., }.
215// Notes:
216// * The generated sequences never include end. For example, Range(1, 5)
217// returns a generator producing a sequence {1, 2, 3, 4}. Range(1, 9, 2)
218// returns a generator producing {1, 3, 5, 7}.
219// * start and end must have the same type. That type may be any integral or
220// floating-point type or a user defined type satisfying these conditions:
221// * It must be assignable (have operator=() defined).
222// * It must have operator+() (operator+(int-compatible type) for
223// two-operand version).
224// * It must have operator<() defined.
225// Elements in the resulting sequences will also have that type.
226// * Condition start < end must be satisfied in order for resulting sequences
227// to contain any elements.
228//
229template <typename T, typename IncrementT>
230internal::ParamGenerator<T> Range(T start, T end, IncrementT step) {
231 return internal::ParamGenerator<T>(
232 new internal::RangeGenerator<T, IncrementT>(start, end, step));
233}
234
235template <typename T>
236internal::ParamGenerator<T> Range(T start, T end) {
237 return Range(start, end, 1);
238}
239
240// ValuesIn() function allows generation of tests with parameters coming from
241// a container.
242//
243// Synopsis:
244// ValuesIn(const T (&array)[N])
245// - returns a generator producing sequences with elements from
246// a C-style array.
247// ValuesIn(const Container& container)
248// - returns a generator producing sequences with elements from
249// an STL-style container.
250// ValuesIn(Iterator begin, Iterator end)
251// - returns a generator producing sequences with elements from
252// a range [begin, end) defined by a pair of STL-style iterators. These
253// iterators can also be plain C pointers.
254//
255// Please note that ValuesIn copies the values from the containers
256// passed in and keeps them to generate tests in RUN_ALL_TESTS().
257//
258// Examples:
259//
260// This instantiates tests from test suite StringTest
261// each with C-string values of "foo", "bar", and "baz":
262//
263// const char* strings[] = {"foo", "bar", "baz"};
264// INSTANTIATE_TEST_SUITE_P(StringSequence, StringTest, ValuesIn(strings));
265//
266// This instantiates tests from test suite StlStringTest
267// each with STL strings with values "a" and "b":
268//
269// ::std::vector< ::std::string> GetParameterStrings() {
270// ::std::vector< ::std::string> v;
271// v.push_back("a");
272// v.push_back("b");
273// return v;
274// }
275//
276// INSTANTIATE_TEST_SUITE_P(CharSequence,
277// StlStringTest,
278// ValuesIn(GetParameterStrings()));
279//
280//
281// This will also instantiate tests from CharTest
282// each with parameter values 'a' and 'b':
283//
284// ::std::list<char> GetParameterChars() {
285// ::std::list<char> list;
286// list.push_back('a');
287// list.push_back('b');
288// return list;
289// }
290// ::std::list<char> l = GetParameterChars();
291// INSTANTIATE_TEST_SUITE_P(CharSequence2,
292// CharTest,
293// ValuesIn(l.begin(), l.end()));
294//
295template <typename ForwardIterator>
296internal::ParamGenerator<
297 typename std::iterator_traits<ForwardIterator>::value_type>
298ValuesIn(ForwardIterator begin, ForwardIterator end) {
299 typedef typename std::iterator_traits<ForwardIterator>::value_type ParamType;
300 return internal::ParamGenerator<ParamType>(
301 new internal::ValuesInIteratorRangeGenerator<ParamType>(begin, end));
302}
303
304template <typename T, size_t N>
305internal::ParamGenerator<T> ValuesIn(const T (&array)[N]) {
306 return ValuesIn(array, array + N);
307}
308
309template <class Container>
310internal::ParamGenerator<typename Container::value_type> ValuesIn(
311 const Container& container) {
312 return ValuesIn(container.begin(), container.end());
313}
314
315// Values() allows generating tests from explicitly specified list of
316// parameters.
317//
318// Synopsis:
319// Values(T v1, T v2, ..., T vN)
320// - returns a generator producing sequences with elements v1, v2, ..., vN.
321//
322// For example, this instantiates tests from test suite BarTest each
323// with values "one", "two", and "three":
324//
325// INSTANTIATE_TEST_SUITE_P(NumSequence,
326// BarTest,
327// Values("one", "two", "three"));
328//
329// This instantiates tests from test suite BazTest each with values 1, 2, 3.5.
330// The exact type of values will depend on the type of parameter in BazTest.
331//
332// INSTANTIATE_TEST_SUITE_P(FloatingNumbers, BazTest, Values(1, 2, 3.5));
333//
334//
335template <typename... T>
336internal::ValueArray<T...> Values(T... v) {
337 return internal::ValueArray<T...>(std::move(v)...);
338}
339
340// Bool() allows generating tests with parameters in a set of (false, true).
341//
342// Synopsis:
343// Bool()
344// - returns a generator producing sequences with elements {false, true}.
345//
346// It is useful when testing code that depends on Boolean flags. Combinations
347// of multiple flags can be tested when several Bool()'s are combined using
348// Combine() function.
349//
350// In the following example all tests in the test suite FlagDependentTest
351// will be instantiated twice with parameters false and true.
352//
353// class FlagDependentTest : public testing::TestWithParam<bool> {
354// virtual void SetUp() {
355// external_flag = GetParam();
356// }
357// }
358// INSTANTIATE_TEST_SUITE_P(BoolSequence, FlagDependentTest, Bool());
359//
360inline internal::ParamGenerator<bool> Bool() { return Values(v: false, v: true); }
361
362// Combine() allows the user to combine two or more sequences to produce
363// values of a Cartesian product of those sequences' elements.
364//
365// Synopsis:
366// Combine(gen1, gen2, ..., genN)
367// - returns a generator producing sequences with elements coming from
368// the Cartesian product of elements from the sequences generated by
369// gen1, gen2, ..., genN. The sequence elements will have a type of
370// std::tuple<T1, T2, ..., TN> where T1, T2, ..., TN are the types
371// of elements from sequences produces by gen1, gen2, ..., genN.
372//
373// Example:
374//
375// This will instantiate tests in test suite AnimalTest each one with
376// the parameter values tuple("cat", BLACK), tuple("cat", WHITE),
377// tuple("dog", BLACK), and tuple("dog", WHITE):
378//
379// enum Color { BLACK, GRAY, WHITE };
380// class AnimalTest
381// : public testing::TestWithParam<std::tuple<const char*, Color> > {...};
382//
383// TEST_P(AnimalTest, AnimalLooksNice) {...}
384//
385// INSTANTIATE_TEST_SUITE_P(AnimalVariations, AnimalTest,
386// Combine(Values("cat", "dog"),
387// Values(BLACK, WHITE)));
388//
389// This will instantiate tests in FlagDependentTest with all variations of two
390// Boolean flags:
391//
392// class FlagDependentTest
393// : public testing::TestWithParam<std::tuple<bool, bool> > {
394// virtual void SetUp() {
395// // Assigns external_flag_1 and external_flag_2 values from the tuple.
396// std::tie(external_flag_1, external_flag_2) = GetParam();
397// }
398// };
399//
400// TEST_P(FlagDependentTest, TestFeature1) {
401// // Test your code using external_flag_1 and external_flag_2 here.
402// }
403// INSTANTIATE_TEST_SUITE_P(TwoBoolSequence, FlagDependentTest,
404// Combine(Bool(), Bool()));
405//
406template <typename... Generator>
407internal::CartesianProductHolder<Generator...> Combine(const Generator&... g) {
408 return internal::CartesianProductHolder<Generator...>(g...);
409}
410
411// ConvertGenerator() wraps a parameter generator in order to cast each produced
412// value through a known type before supplying it to the test suite
413//
414// Synopsis:
415// ConvertGenerator<T>(gen)
416// - returns a generator producing the same elements as generated by gen, but
417// each T-typed element is static_cast to a type deduced from the interface
418// that accepts this generator, and then returned
419//
420// It is useful when using the Combine() function to get the generated
421// parameters in a custom type instead of std::tuple
422//
423// Example:
424//
425// This will instantiate tests in test suite AnimalTest each one with
426// the parameter values tuple("cat", BLACK), tuple("cat", WHITE),
427// tuple("dog", BLACK), and tuple("dog", WHITE):
428//
429// enum Color { BLACK, GRAY, WHITE };
430// struct ParamType {
431// using TupleT = std::tuple<const char*, Color>;
432// std::string animal;
433// Color color;
434// ParamType(TupleT t) : animal(std::get<0>(t)), color(std::get<1>(t)) {}
435// };
436// class AnimalTest
437// : public testing::TestWithParam<ParamType> {...};
438//
439// TEST_P(AnimalTest, AnimalLooksNice) {...}
440//
441// INSTANTIATE_TEST_SUITE_P(AnimalVariations, AnimalTest,
442// ConvertGenerator<ParamType::TupleT>(
443// Combine(Values("cat", "dog"),
444// Values(BLACK, WHITE))));
445//
446template <typename RequestedT>
447internal::ParamConverterGenerator<RequestedT> ConvertGenerator(
448 internal::ParamGenerator<RequestedT> gen) {
449 return internal::ParamConverterGenerator<RequestedT>(std::move(gen));
450}
451
452// As above, but takes a callable as a second argument. The callable converts
453// the generated parameter to the test fixture's parameter type. This allows you
454// to use a parameter type that does not have a converting constructor from the
455// generated type.
456//
457// Example:
458//
459// This will instantiate tests in test suite AnimalTest each one with
460// the parameter values tuple("cat", BLACK), tuple("cat", WHITE),
461// tuple("dog", BLACK), and tuple("dog", WHITE):
462//
463// enum Color { BLACK, GRAY, WHITE };
464// struct ParamType {
465// std::string animal;
466// Color color;
467// };
468// class AnimalTest
469// : public testing::TestWithParam<ParamType> {...};
470//
471// TEST_P(AnimalTest, AnimalLooksNice) {...}
472//
473// INSTANTIATE_TEST_SUITE_P(
474// AnimalVariations, AnimalTest,
475// ConvertGenerator(Combine(Values("cat", "dog"), Values(BLACK, WHITE)),
476// [](std::tuple<std::string, Color> t) {
477// return ParamType{.animal = std::get<0>(t),
478// .color = std::get<1>(t)};
479// }));
480//
481template <typename T, int&... ExplicitArgumentBarrier, typename Gen,
482 typename Func,
483 typename StdFunction = decltype(std::function(std::declval<Func>()))>
484internal::ParamConverterGenerator<T, StdFunction> ConvertGenerator(Gen&& gen,
485 Func&& f) {
486 return internal::ParamConverterGenerator<T, StdFunction>(
487 std::forward<Gen>(gen), std::forward<Func>(f));
488}
489
490// As above, but infers the T from the supplied std::function instead of
491// having the caller specify it.
492template <int&... ExplicitArgumentBarrier, typename Gen, typename Func,
493 typename StdFunction = decltype(std::function(std::declval<Func>()))>
494auto ConvertGenerator(Gen&& gen, Func&& f) {
495 constexpr bool is_single_arg_std_function =
496 internal::IsSingleArgStdFunction<StdFunction>::value;
497 if constexpr (is_single_arg_std_function) {
498 return ConvertGenerator<
499 typename internal::FuncSingleParamType<StdFunction>::type>(
500 std::forward<Gen>(gen), std::forward<Func>(f));
501 } else {
502 static_assert(is_single_arg_std_function,
503 "The call signature must contain a single argument.");
504 }
505}
506
507#define TEST_P(test_suite_name, test_name) \
508 class GTEST_TEST_CLASS_NAME_(test_suite_name, test_name) \
509 : public test_suite_name, \
510 private ::testing::internal::GTestNonCopyable { \
511 public: \
512 GTEST_TEST_CLASS_NAME_(test_suite_name, test_name)() {} \
513 void TestBody() override; \
514 \
515 private: \
516 static int AddToRegistry() { \
517 ::testing::UnitTest::GetInstance() \
518 ->parameterized_test_registry() \
519 .GetTestSuitePatternHolder<test_suite_name>( \
520 GTEST_STRINGIFY_(test_suite_name), \
521 ::testing::internal::CodeLocation(__FILE__, __LINE__)) \
522 ->AddTestPattern( \
523 GTEST_STRINGIFY_(test_suite_name), GTEST_STRINGIFY_(test_name), \
524 new ::testing::internal::TestMetaFactory<GTEST_TEST_CLASS_NAME_( \
525 test_suite_name, test_name)>(), \
526 ::testing::internal::CodeLocation(__FILE__, __LINE__)); \
527 return 0; \
528 } \
529 [[maybe_unused]] static int gtest_registering_dummy_; \
530 }; \
531 int GTEST_TEST_CLASS_NAME_(test_suite_name, \
532 test_name)::gtest_registering_dummy_ = \
533 GTEST_TEST_CLASS_NAME_(test_suite_name, test_name)::AddToRegistry(); \
534 void GTEST_TEST_CLASS_NAME_(test_suite_name, test_name)::TestBody()
535
536// The last argument to INSTANTIATE_TEST_SUITE_P allows the user to specify
537// generator and an optional function or functor that generates custom test name
538// suffixes based on the test parameters. Such a function or functor should
539// accept one argument of type testing::TestParamInfo<class ParamType>, and
540// return std::string.
541//
542// testing::PrintToStringParamName is a builtin test suffix generator that
543// returns the value of testing::PrintToString(GetParam()).
544//
545// Note: test names must be non-empty, unique, and may only contain ASCII
546// alphanumeric characters or underscore. Because PrintToString adds quotes
547// to std::string and C strings, it won't work for these types.
548
549#define GTEST_EXPAND_(arg) arg
550#define GTEST_GET_FIRST_(first, ...) first
551#define GTEST_GET_SECOND_(first, second, ...) second
552
553#define INSTANTIATE_TEST_SUITE_P(prefix, test_suite_name, ...) \
554 static ::testing::internal::ParamGenerator<test_suite_name::ParamType> \
555 gtest_##prefix##test_suite_name##_EvalGenerator_() { \
556 return GTEST_EXPAND_(GTEST_GET_FIRST_(__VA_ARGS__, DUMMY_PARAM_)); \
557 } \
558 static ::std::string gtest_##prefix##test_suite_name##_EvalGenerateName_( \
559 const ::testing::TestParamInfo<test_suite_name::ParamType>& info) { \
560 if (::testing::internal::AlwaysFalse()) { \
561 ::testing::internal::TestNotEmpty(GTEST_EXPAND_(GTEST_GET_SECOND_( \
562 __VA_ARGS__, \
563 ::testing::internal::DefaultParamName<test_suite_name::ParamType>, \
564 DUMMY_PARAM_))); \
565 auto t = std::make_tuple(__VA_ARGS__); \
566 static_assert(std::tuple_size<decltype(t)>::value <= 2, \
567 "Too Many Args!"); \
568 } \
569 return ((GTEST_EXPAND_(GTEST_GET_SECOND_( \
570 __VA_ARGS__, \
571 ::testing::internal::DefaultParamName<test_suite_name::ParamType>, \
572 DUMMY_PARAM_))))(info); \
573 } \
574 [[maybe_unused]] static int gtest_##prefix##test_suite_name##_dummy_ = \
575 ::testing::UnitTest::GetInstance() \
576 ->parameterized_test_registry() \
577 .GetTestSuitePatternHolder<test_suite_name>( \
578 GTEST_STRINGIFY_(test_suite_name), \
579 ::testing::internal::CodeLocation(__FILE__, __LINE__)) \
580 ->AddTestSuiteInstantiation( \
581 GTEST_STRINGIFY_(prefix), \
582 &gtest_##prefix##test_suite_name##_EvalGenerator_, \
583 &gtest_##prefix##test_suite_name##_EvalGenerateName_, __FILE__, \
584 __LINE__)
585
586// Allow Marking a Parameterized test class as not needing to be instantiated.
587#define GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(T) \
588 namespace gtest_do_not_use_outside_namespace_scope {} \
589 static const ::testing::internal::MarkAsIgnored gtest_allow_ignore_##T( \
590 GTEST_STRINGIFY_(T))
591
592// Legacy API is deprecated but still available
593#ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_
594#define INSTANTIATE_TEST_CASE_P \
595 static_assert(::testing::internal::InstantiateTestCase_P_IsDeprecated(), \
596 ""); \
597 INSTANTIATE_TEST_SUITE_P
598#endif // GTEST_REMOVE_LEGACY_TEST_CASEAPI_
599
600} // namespace testing
601
602#endif // GOOGLETEST_INCLUDE_GTEST_GTEST_PARAM_TEST_H_
603