Blame nss/external_tests/google_test/gtest/include/gtest/gtest-param-test.h.pump

Packit 40b132
$$ -*- mode: c++; -*-
Packit 40b132
$var n = 50  $$ Maximum length of Values arguments we want to support.
Packit 40b132
$var maxtuple = 10  $$ Maximum number of Combine arguments we want to support.
Packit 40b132
// Copyright 2008, Google Inc.
Packit 40b132
// All rights reserved.
Packit 40b132
//
Packit 40b132
// Redistribution and use in source and binary forms, with or without
Packit 40b132
// modification, are permitted provided that the following conditions are
Packit 40b132
// met:
Packit 40b132
//
Packit 40b132
//     * Redistributions of source code must retain the above copyright
Packit 40b132
// notice, this list of conditions and the following disclaimer.
Packit 40b132
//     * Redistributions in binary form must reproduce the above
Packit 40b132
// copyright notice, this list of conditions and the following disclaimer
Packit 40b132
// in the documentation and/or other materials provided with the
Packit 40b132
// distribution.
Packit 40b132
//     * Neither the name of Google Inc. nor the names of its
Packit 40b132
// contributors may be used to endorse or promote products derived from
Packit 40b132
// this software without specific prior written permission.
Packit 40b132
//
Packit 40b132
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
Packit 40b132
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
Packit 40b132
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
Packit 40b132
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
Packit 40b132
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
Packit 40b132
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
Packit 40b132
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
Packit 40b132
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
Packit 40b132
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
Packit 40b132
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
Packit 40b132
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Packit 40b132
//
Packit 40b132
// Authors: vladl@google.com (Vlad Losev)
Packit 40b132
//
Packit 40b132
// Macros and functions for implementing parameterized tests
Packit 40b132
// in Google C++ Testing Framework (Google Test)
Packit 40b132
//
Packit 40b132
// This file is generated by a SCRIPT.  DO NOT EDIT BY HAND!
Packit 40b132
//
Packit 40b132
#ifndef GTEST_INCLUDE_GTEST_GTEST_PARAM_TEST_H_
Packit 40b132
#define GTEST_INCLUDE_GTEST_GTEST_PARAM_TEST_H_
Packit 40b132
Packit 40b132
Packit 40b132
// Value-parameterized tests allow you to test your code with different
Packit 40b132
// parameters without writing multiple copies of the same test.
Packit 40b132
//
Packit 40b132
// Here is how you use value-parameterized tests:
Packit 40b132
Packit 40b132
#if 0
Packit 40b132
Packit 40b132
// To write value-parameterized tests, first you should define a fixture
Packit 40b132
// class. It is usually derived from testing::TestWithParam<T> (see below for
Packit 40b132
// another inheritance scheme that's sometimes useful in more complicated
Packit 40b132
// class hierarchies), where the type of your parameter values.
Packit 40b132
// TestWithParam<T> is itself derived from testing::Test. T can be any
Packit 40b132
// copyable type. If it's a raw pointer, you are responsible for managing the
Packit 40b132
// lifespan of the pointed values.
Packit 40b132
Packit 40b132
class FooTest : public ::testing::TestWithParam<const char*> {
Packit 40b132
  // You can implement all the usual class fixture members here.
Packit 40b132
};
Packit 40b132
Packit 40b132
// Then, use the TEST_P macro to define as many parameterized tests
Packit 40b132
// for this fixture as you want. The _P suffix is for "parameterized"
Packit 40b132
// or "pattern", whichever you prefer to think.
Packit 40b132
Packit 40b132
TEST_P(FooTest, DoesBlah) {
Packit 40b132
  // Inside a test, access the test parameter with the GetParam() method
Packit 40b132
  // of the TestWithParam<T> class:
Packit 40b132
  EXPECT_TRUE(foo.Blah(GetParam()));
Packit 40b132
  ...
Packit 40b132
}
Packit 40b132
Packit 40b132
TEST_P(FooTest, HasBlahBlah) {
Packit 40b132
  ...
Packit 40b132
}
Packit 40b132
Packit 40b132
// Finally, you can use INSTANTIATE_TEST_CASE_P to instantiate the test
Packit 40b132
// case with any set of parameters you want. Google Test defines a number
Packit 40b132
// of functions for generating test parameters. They return what we call
Packit 40b132
// (surprise!) parameter generators. Here is a  summary of them, which
Packit 40b132
// are all in the testing namespace:
Packit 40b132
//
Packit 40b132
//
Packit 40b132
//  Range(begin, end [, step]) - Yields values {begin, begin+step,
Packit 40b132
//                               begin+step+step, ...}. The values do not
Packit 40b132
//                               include end. step defaults to 1.
Packit 40b132
//  Values(v1, v2, ..., vN)    - Yields values {v1, v2, ..., vN}.
Packit 40b132
//  ValuesIn(container)        - Yields values from a C-style array, an STL
Packit 40b132
//  ValuesIn(begin,end)          container, or an iterator range [begin, end).
Packit 40b132
//  Bool()                     - Yields sequence {false, true}.
Packit 40b132
//  Combine(g1, g2, ..., gN)   - Yields all combinations (the Cartesian product
Packit 40b132
//                               for the math savvy) of the values generated
Packit 40b132
//                               by the N generators.
Packit 40b132
//
Packit 40b132
// For more details, see comments at the definitions of these functions below
Packit 40b132
// in this file.
Packit 40b132
//
Packit 40b132
// The following statement will instantiate tests from the FooTest test case
Packit 40b132
// each with parameter values "meeny", "miny", and "moe".
Packit 40b132
Packit 40b132
INSTANTIATE_TEST_CASE_P(InstantiationName,
Packit 40b132
                        FooTest,
Packit 40b132
                        Values("meeny", "miny", "moe"));
Packit 40b132
Packit 40b132
// To distinguish different instances of the pattern, (yes, you
Packit 40b132
// can instantiate it more then once) the first argument to the
Packit 40b132
// INSTANTIATE_TEST_CASE_P macro is a prefix that will be added to the
Packit 40b132
// actual test case name. Remember to pick unique prefixes for different
Packit 40b132
// instantiations. The tests from the instantiation above will have
Packit 40b132
// these names:
Packit 40b132
//
Packit 40b132
//    * InstantiationName/FooTest.DoesBlah/0 for "meeny"
Packit 40b132
//    * InstantiationName/FooTest.DoesBlah/1 for "miny"
Packit 40b132
//    * InstantiationName/FooTest.DoesBlah/2 for "moe"
Packit 40b132
//    * InstantiationName/FooTest.HasBlahBlah/0 for "meeny"
Packit 40b132
//    * InstantiationName/FooTest.HasBlahBlah/1 for "miny"
Packit 40b132
//    * InstantiationName/FooTest.HasBlahBlah/2 for "moe"
Packit 40b132
//
Packit 40b132
// You can use these names in --gtest_filter.
Packit 40b132
//
Packit 40b132
// This statement will instantiate all tests from FooTest again, each
Packit 40b132
// with parameter values "cat" and "dog":
Packit 40b132
Packit 40b132
const char* pets[] = {"cat", "dog"};
Packit 40b132
INSTANTIATE_TEST_CASE_P(AnotherInstantiationName, FooTest, ValuesIn(pets));
Packit 40b132
Packit 40b132
// The tests from the instantiation above will have these names:
Packit 40b132
//
Packit 40b132
//    * AnotherInstantiationName/FooTest.DoesBlah/0 for "cat"
Packit 40b132
//    * AnotherInstantiationName/FooTest.DoesBlah/1 for "dog"
Packit 40b132
//    * AnotherInstantiationName/FooTest.HasBlahBlah/0 for "cat"
Packit 40b132
//    * AnotherInstantiationName/FooTest.HasBlahBlah/1 for "dog"
Packit 40b132
//
Packit 40b132
// Please note that INSTANTIATE_TEST_CASE_P will instantiate all tests
Packit 40b132
// in the given test case, whether their definitions come before or
Packit 40b132
// AFTER the INSTANTIATE_TEST_CASE_P statement.
Packit 40b132
//
Packit 40b132
// Please also note that generator expressions (including parameters to the
Packit 40b132
// generators) are evaluated in InitGoogleTest(), after main() has started.
Packit 40b132
// This allows the user on one hand, to adjust generator parameters in order
Packit 40b132
// to dynamically determine a set of tests to run and on the other hand,
Packit 40b132
// give the user a chance to inspect the generated tests with Google Test
Packit 40b132
// reflection API before RUN_ALL_TESTS() is executed.
Packit 40b132
//
Packit 40b132
// You can see samples/sample7_unittest.cc and samples/sample8_unittest.cc
Packit 40b132
// for more examples.
Packit 40b132
//
Packit 40b132
// In the future, we plan to publish the API for defining new parameter
Packit 40b132
// generators. But for now this interface remains part of the internal
Packit 40b132
// implementation and is subject to change.
Packit 40b132
//
Packit 40b132
//
Packit 40b132
// A parameterized test fixture must be derived from testing::Test and from
Packit 40b132
// testing::WithParamInterface<T>, where T is the type of the parameter
Packit 40b132
// values. Inheriting from TestWithParam<T> satisfies that requirement because
Packit 40b132
// TestWithParam<T> inherits from both Test and WithParamInterface. In more
Packit 40b132
// complicated hierarchies, however, it is occasionally useful to inherit
Packit 40b132
// separately from Test and WithParamInterface. For example:
Packit 40b132
Packit 40b132
class BaseTest : public ::testing::Test {
Packit 40b132
  // You can inherit all the usual members for a non-parameterized test
Packit 40b132
  // fixture here.
Packit 40b132
};
Packit 40b132
Packit 40b132
class DerivedTest : public BaseTest, public ::testing::WithParamInterface<int> {
Packit 40b132
  // The usual test fixture members go here too.
Packit 40b132
};
Packit 40b132
Packit 40b132
TEST_F(BaseTest, HasFoo) {
Packit 40b132
  // This is an ordinary non-parameterized test.
Packit 40b132
}
Packit 40b132
Packit 40b132
TEST_P(DerivedTest, DoesBlah) {
Packit 40b132
  // GetParam works just the same here as if you inherit from TestWithParam.
Packit 40b132
  EXPECT_TRUE(foo.Blah(GetParam()));
Packit 40b132
}
Packit 40b132
Packit 40b132
#endif  // 0
Packit 40b132
Packit 40b132
#include "gtest/internal/gtest-port.h"
Packit 40b132
Packit 40b132
#if !GTEST_OS_SYMBIAN
Packit 40b132
# include <utility>
Packit 40b132
#endif
Packit 40b132
Packit 40b132
// scripts/fuse_gtest.py depends on gtest's own header being #included
Packit 40b132
// *unconditionally*.  Therefore these #includes cannot be moved
Packit 40b132
// inside #if GTEST_HAS_PARAM_TEST.
Packit 40b132
#include "gtest/internal/gtest-internal.h"
Packit 40b132
#include "gtest/internal/gtest-param-util.h"
Packit 40b132
#include "gtest/internal/gtest-param-util-generated.h"
Packit 40b132
Packit 40b132
#if GTEST_HAS_PARAM_TEST
Packit 40b132
Packit 40b132
namespace testing {
Packit 40b132
Packit 40b132
// Functions producing parameter generators.
Packit 40b132
//
Packit 40b132
// Google Test uses these generators to produce parameters for value-
Packit 40b132
// parameterized tests. When a parameterized test case is instantiated
Packit 40b132
// with a particular generator, Google Test creates and runs tests
Packit 40b132
// for each element in the sequence produced by the generator.
Packit 40b132
//
Packit 40b132
// In the following sample, tests from test case FooTest are instantiated
Packit 40b132
// each three times with parameter values 3, 5, and 8:
Packit 40b132
//
Packit 40b132
// class FooTest : public TestWithParam<int> { ... };
Packit 40b132
//
Packit 40b132
// TEST_P(FooTest, TestThis) {
Packit 40b132
// }
Packit 40b132
// TEST_P(FooTest, TestThat) {
Packit 40b132
// }
Packit 40b132
// INSTANTIATE_TEST_CASE_P(TestSequence, FooTest, Values(3, 5, 8));
Packit 40b132
//
Packit 40b132
Packit 40b132
// Range() returns generators providing sequences of values in a range.
Packit 40b132
//
Packit 40b132
// Synopsis:
Packit 40b132
// Range(start, end)
Packit 40b132
//   - returns a generator producing a sequence of values {start, start+1,
Packit 40b132
//     start+2, ..., }.
Packit 40b132
// Range(start, end, step)
Packit 40b132
//   - returns a generator producing a sequence of values {start, start+step,
Packit 40b132
//     start+step+step, ..., }.
Packit 40b132
// Notes:
Packit 40b132
//   * The generated sequences never include end. For example, Range(1, 5)
Packit 40b132
//     returns a generator producing a sequence {1, 2, 3, 4}. Range(1, 9, 2)
Packit 40b132
//     returns a generator producing {1, 3, 5, 7}.
Packit 40b132
//   * start and end must have the same type. That type may be any integral or
Packit 40b132
//     floating-point type or a user defined type satisfying these conditions:
Packit 40b132
//     * It must be assignable (have operator=() defined).
Packit 40b132
//     * It must have operator+() (operator+(int-compatible type) for
Packit 40b132
//       two-operand version).
Packit 40b132
//     * It must have operator<() defined.
Packit 40b132
//     Elements in the resulting sequences will also have that type.
Packit 40b132
//   * Condition start < end must be satisfied in order for resulting sequences
Packit 40b132
//     to contain any elements.
Packit 40b132
//
Packit 40b132
template <typename T, typename IncrementT>
Packit 40b132
internal::ParamGenerator<T> Range(T start, T end, IncrementT step) {
Packit 40b132
  return internal::ParamGenerator<T>(
Packit 40b132
      new internal::RangeGenerator<T, IncrementT>(start, end, step));
Packit 40b132
}
Packit 40b132
Packit 40b132
template <typename T>
Packit 40b132
internal::ParamGenerator<T> Range(T start, T end) {
Packit 40b132
  return Range(start, end, 1);
Packit 40b132
}
Packit 40b132
Packit 40b132
// ValuesIn() function allows generation of tests with parameters coming from
Packit 40b132
// a container.
Packit 40b132
//
Packit 40b132
// Synopsis:
Packit 40b132
// ValuesIn(const T (&array)[N])
Packit 40b132
//   - returns a generator producing sequences with elements from
Packit 40b132
//     a C-style array.
Packit 40b132
// ValuesIn(const Container& container)
Packit 40b132
//   - returns a generator producing sequences with elements from
Packit 40b132
//     an STL-style container.
Packit 40b132
// ValuesIn(Iterator begin, Iterator end)
Packit 40b132
//   - returns a generator producing sequences with elements from
Packit 40b132
//     a range [begin, end) defined by a pair of STL-style iterators. These
Packit 40b132
//     iterators can also be plain C pointers.
Packit 40b132
//
Packit 40b132
// Please note that ValuesIn copies the values from the containers
Packit 40b132
// passed in and keeps them to generate tests in RUN_ALL_TESTS().
Packit 40b132
//
Packit 40b132
// Examples:
Packit 40b132
//
Packit 40b132
// This instantiates tests from test case StringTest
Packit 40b132
// each with C-string values of "foo", "bar", and "baz":
Packit 40b132
//
Packit 40b132
// const char* strings[] = {"foo", "bar", "baz"};
Packit 40b132
// INSTANTIATE_TEST_CASE_P(StringSequence, SrtingTest, ValuesIn(strings));
Packit 40b132
//
Packit 40b132
// This instantiates tests from test case StlStringTest
Packit 40b132
// each with STL strings with values "a" and "b":
Packit 40b132
//
Packit 40b132
// ::std::vector< ::std::string> GetParameterStrings() {
Packit 40b132
//   ::std::vector< ::std::string> v;
Packit 40b132
//   v.push_back("a");
Packit 40b132
//   v.push_back("b");
Packit 40b132
//   return v;
Packit 40b132
// }
Packit 40b132
//
Packit 40b132
// INSTANTIATE_TEST_CASE_P(CharSequence,
Packit 40b132
//                         StlStringTest,
Packit 40b132
//                         ValuesIn(GetParameterStrings()));
Packit 40b132
//
Packit 40b132
//
Packit 40b132
// This will also instantiate tests from CharTest
Packit 40b132
// each with parameter values 'a' and 'b':
Packit 40b132
//
Packit 40b132
// ::std::list<char> GetParameterChars() {
Packit 40b132
//   ::std::list<char> list;
Packit 40b132
//   list.push_back('a');
Packit 40b132
//   list.push_back('b');
Packit 40b132
//   return list;
Packit 40b132
// }
Packit 40b132
// ::std::list<char> l = GetParameterChars();
Packit 40b132
// INSTANTIATE_TEST_CASE_P(CharSequence2,
Packit 40b132
//                         CharTest,
Packit 40b132
//                         ValuesIn(l.begin(), l.end()));
Packit 40b132
//
Packit 40b132
template <typename ForwardIterator>
Packit 40b132
internal::ParamGenerator<
Packit 40b132
  typename ::testing::internal::IteratorTraits<ForwardIterator>::value_type>
Packit 40b132
ValuesIn(ForwardIterator begin, ForwardIterator end) {
Packit 40b132
  typedef typename ::testing::internal::IteratorTraits<ForwardIterator>
Packit 40b132
      ::value_type ParamType;
Packit 40b132
  return internal::ParamGenerator<ParamType>(
Packit 40b132
      new internal::ValuesInIteratorRangeGenerator<ParamType>(begin, end));
Packit 40b132
}
Packit 40b132
Packit 40b132
template <typename T, size_t N>
Packit 40b132
internal::ParamGenerator<T> ValuesIn(const T (&array)[N]) {
Packit 40b132
  return ValuesIn(array, array + N);
Packit 40b132
}
Packit 40b132
Packit 40b132
template <class Container>
Packit 40b132
internal::ParamGenerator<typename Container::value_type> ValuesIn(
Packit 40b132
    const Container& container) {
Packit 40b132
  return ValuesIn(container.begin(), container.end());
Packit 40b132
}
Packit 40b132
Packit 40b132
// Values() allows generating tests from explicitly specified list of
Packit 40b132
// parameters.
Packit 40b132
//
Packit 40b132
// Synopsis:
Packit 40b132
// Values(T v1, T v2, ..., T vN)
Packit 40b132
//   - returns a generator producing sequences with elements v1, v2, ..., vN.
Packit 40b132
//
Packit 40b132
// For example, this instantiates tests from test case BarTest each
Packit 40b132
// with values "one", "two", and "three":
Packit 40b132
//
Packit 40b132
// INSTANTIATE_TEST_CASE_P(NumSequence, BarTest, Values("one", "two", "three"));
Packit 40b132
//
Packit 40b132
// This instantiates tests from test case BazTest each with values 1, 2, 3.5.
Packit 40b132
// The exact type of values will depend on the type of parameter in BazTest.
Packit 40b132
//
Packit 40b132
// INSTANTIATE_TEST_CASE_P(FloatingNumbers, BazTest, Values(1, 2, 3.5));
Packit 40b132
//
Packit 40b132
// Currently, Values() supports from 1 to $n parameters.
Packit 40b132
//
Packit 40b132
$range i 1..n
Packit 40b132
$for i [[
Packit 40b132
$range j 1..i
Packit 40b132
Packit 40b132
template <$for j, [[typename T$j]]>
Packit 40b132
internal::ValueArray$i<$for j, [[T$j]]> Values($for j, [[T$j v$j]]) {
Packit 40b132
  return internal::ValueArray$i<$for j, [[T$j]]>($for j, [[v$j]]);
Packit 40b132
}
Packit 40b132
Packit 40b132
]]
Packit 40b132
Packit 40b132
// Bool() allows generating tests with parameters in a set of (false, true).
Packit 40b132
//
Packit 40b132
// Synopsis:
Packit 40b132
// Bool()
Packit 40b132
//   - returns a generator producing sequences with elements {false, true}.
Packit 40b132
//
Packit 40b132
// It is useful when testing code that depends on Boolean flags. Combinations
Packit 40b132
// of multiple flags can be tested when several Bool()'s are combined using
Packit 40b132
// Combine() function.
Packit 40b132
//
Packit 40b132
// In the following example all tests in the test case FlagDependentTest
Packit 40b132
// will be instantiated twice with parameters false and true.
Packit 40b132
//
Packit 40b132
// class FlagDependentTest : public testing::TestWithParam<bool> {
Packit 40b132
//   virtual void SetUp() {
Packit 40b132
//     external_flag = GetParam();
Packit 40b132
//   }
Packit 40b132
// }
Packit 40b132
// INSTANTIATE_TEST_CASE_P(BoolSequence, FlagDependentTest, Bool());
Packit 40b132
//
Packit 40b132
inline internal::ParamGenerator<bool> Bool() {
Packit 40b132
  return Values(false, true);
Packit 40b132
}
Packit 40b132
Packit 40b132
# if GTEST_HAS_COMBINE
Packit 40b132
// Combine() allows the user to combine two or more sequences to produce
Packit 40b132
// values of a Cartesian product of those sequences' elements.
Packit 40b132
//
Packit 40b132
// Synopsis:
Packit 40b132
// Combine(gen1, gen2, ..., genN)
Packit 40b132
//   - returns a generator producing sequences with elements coming from
Packit 40b132
//     the Cartesian product of elements from the sequences generated by
Packit 40b132
//     gen1, gen2, ..., genN. The sequence elements will have a type of
Packit 40b132
//     tuple<T1, T2, ..., TN> where T1, T2, ..., TN are the types
Packit 40b132
//     of elements from sequences produces by gen1, gen2, ..., genN.
Packit 40b132
//
Packit 40b132
// Combine can have up to $maxtuple arguments. This number is currently limited
Packit 40b132
// by the maximum number of elements in the tuple implementation used by Google
Packit 40b132
// Test.
Packit 40b132
//
Packit 40b132
// Example:
Packit 40b132
//
Packit 40b132
// This will instantiate tests in test case AnimalTest each one with
Packit 40b132
// the parameter values tuple("cat", BLACK), tuple("cat", WHITE),
Packit 40b132
// tuple("dog", BLACK), and tuple("dog", WHITE):
Packit 40b132
//
Packit 40b132
// enum Color { BLACK, GRAY, WHITE };
Packit 40b132
// class AnimalTest
Packit 40b132
//     : public testing::TestWithParam<tuple<const char*, Color> > {...};
Packit 40b132
//
Packit 40b132
// TEST_P(AnimalTest, AnimalLooksNice) {...}
Packit 40b132
//
Packit 40b132
// INSTANTIATE_TEST_CASE_P(AnimalVariations, AnimalTest,
Packit 40b132
//                         Combine(Values("cat", "dog"),
Packit 40b132
//                                 Values(BLACK, WHITE)));
Packit 40b132
//
Packit 40b132
// This will instantiate tests in FlagDependentTest with all variations of two
Packit 40b132
// Boolean flags:
Packit 40b132
//
Packit 40b132
// class FlagDependentTest
Packit 40b132
//     : public testing::TestWithParam<tuple<bool, bool> > {
Packit 40b132
//   virtual void SetUp() {
Packit 40b132
//     // Assigns external_flag_1 and external_flag_2 values from the tuple.
Packit 40b132
//     tie(external_flag_1, external_flag_2) = GetParam();
Packit 40b132
//   }
Packit 40b132
// };
Packit 40b132
//
Packit 40b132
// TEST_P(FlagDependentTest, TestFeature1) {
Packit 40b132
//   // Test your code using external_flag_1 and external_flag_2 here.
Packit 40b132
// }
Packit 40b132
// INSTANTIATE_TEST_CASE_P(TwoBoolSequence, FlagDependentTest,
Packit 40b132
//                         Combine(Bool(), Bool()));
Packit 40b132
//
Packit 40b132
$range i 2..maxtuple
Packit 40b132
$for i [[
Packit 40b132
$range j 1..i
Packit 40b132
Packit 40b132
template <$for j, [[typename Generator$j]]>
Packit 40b132
internal::CartesianProductHolder$i<$for j, [[Generator$j]]> Combine(
Packit 40b132
    $for j, [[const Generator$j& g$j]]) {
Packit 40b132
  return internal::CartesianProductHolder$i<$for j, [[Generator$j]]>(
Packit 40b132
      $for j, [[g$j]]);
Packit 40b132
}
Packit 40b132
Packit 40b132
]]
Packit 40b132
# endif  // GTEST_HAS_COMBINE
Packit 40b132
Packit 40b132
Packit 40b132
Packit 40b132
# define TEST_P(test_case_name, test_name) \
Packit 40b132
  class GTEST_TEST_CLASS_NAME_(test_case_name, test_name) \
Packit 40b132
      : public test_case_name { \
Packit 40b132
   public: \
Packit 40b132
    GTEST_TEST_CLASS_NAME_(test_case_name, test_name)() {} \
Packit 40b132
    virtual void TestBody(); \
Packit 40b132
   private: \
Packit 40b132
    static int AddToRegistry() { \
Packit 40b132
      ::testing::UnitTest::GetInstance()->parameterized_test_registry(). \
Packit 40b132
          GetTestCasePatternHolder<test_case_name>(\
Packit 40b132
              #test_case_name, __FILE__, __LINE__)->AddTestPattern(\
Packit 40b132
                  #test_case_name, \
Packit 40b132
                  #test_name, \
Packit 40b132
                  new ::testing::internal::TestMetaFactory< \
Packit 40b132
                      GTEST_TEST_CLASS_NAME_(test_case_name, test_name)>()); \
Packit 40b132
      return 0; \
Packit 40b132
    } \
Packit 40b132
    static int gtest_registering_dummy_; \
Packit 40b132
    GTEST_DISALLOW_COPY_AND_ASSIGN_(\
Packit 40b132
        GTEST_TEST_CLASS_NAME_(test_case_name, test_name)); \
Packit 40b132
  }; \
Packit 40b132
  int GTEST_TEST_CLASS_NAME_(test_case_name, \
Packit 40b132
                             test_name)::gtest_registering_dummy_ = \
Packit 40b132
      GTEST_TEST_CLASS_NAME_(test_case_name, test_name)::AddToRegistry(); \
Packit 40b132
  void GTEST_TEST_CLASS_NAME_(test_case_name, test_name)::TestBody()
Packit 40b132
Packit 40b132
# define INSTANTIATE_TEST_CASE_P(prefix, test_case_name, generator) \
Packit 40b132
  ::testing::internal::ParamGenerator<test_case_name::ParamType> \
Packit 40b132
      gtest_##prefix##test_case_name##_EvalGenerator_() { return generator; } \
Packit 40b132
  int gtest_##prefix##test_case_name##_dummy_ = \
Packit 40b132
      ::testing::UnitTest::GetInstance()->parameterized_test_registry(). \
Packit 40b132
          GetTestCasePatternHolder<test_case_name>(\
Packit 40b132
              #test_case_name, __FILE__, __LINE__)->AddTestCaseInstantiation(\
Packit 40b132
                  #prefix, \
Packit 40b132
                  &gtest_##prefix##test_case_name##_EvalGenerator_, \
Packit 40b132
                  __FILE__, __LINE__)
Packit 40b132
Packit 40b132
}  // namespace testing
Packit 40b132
Packit 40b132
#endif  // GTEST_HAS_PARAM_TEST
Packit 40b132
Packit 40b132
#endif  // GTEST_INCLUDE_GTEST_GTEST_PARAM_TEST_H_