googletest-param-test-test.cc
Go to the documentation of this file.
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 //
31 // Tests for Google Test itself. This file verifies that the parameter
32 // generators objects produce correct parameter sequences and that
33 // Google Test runtime instantiates correct tests from those sequences.
34 
35 #include "gtest/gtest.h"
36 
37 # include <algorithm>
38 # include <iostream>
39 # include <list>
40 # include <sstream>
41 # include <string>
42 # include <vector>
43 
44 # include "src/gtest-internal-inl.h" // for UnitTestOptions
46 
47 using ::std::vector;
48 using ::std::sort;
49 
53 using ::testing::Message;
55 using ::testing::TestWithParam;
58 
59 using ::testing::internal::ParamGenerator;
60 using ::testing::internal::UnitTestOptions;
61 
62 // Prints a value to a string.
63 //
64 // FIXME: remove PrintValue() when we move matchers and
65 // EXPECT_THAT() from Google Mock to Google Test. At that time, we
66 // can write EXPECT_THAT(x, Eq(y)) to compare two tuples x and y, as
67 // EXPECT_THAT() and the matchers know how to print tuples.
68 template <typename T>
71 }
72 
73 // Verifies that a sequence generated by the generator and accessed
74 // via the iterator object matches the expected one using Google Test
75 // assertions.
76 template <typename T, size_t N>
77 void VerifyGenerator(const ParamGenerator<T>& generator,
78  const T (&expected_values)[N]) {
79  typename ParamGenerator<T>::iterator it = generator.begin();
80  for (size_t i = 0; i < N; ++i) {
81  ASSERT_FALSE(it == generator.end())
82  << "At element " << i << " when accessing via an iterator "
83  << "created with the copy constructor.\n";
84  // We cannot use EXPECT_EQ() here as the values may be tuples,
85  // which don't support <<.
86  EXPECT_TRUE(expected_values[i] == *it)
87  << "where i is " << i
88  << ", expected_values[i] is " << PrintValue(expected_values[i])
89  << ", *it is " << PrintValue(*it)
90  << ", and 'it' is an iterator created with the copy constructor.\n";
91  ++it;
92  }
93  EXPECT_TRUE(it == generator.end())
94  << "At the presumed end of sequence when accessing via an iterator "
95  << "created with the copy constructor.\n";
96 
97  // Test the iterator assignment. The following lines verify that
98  // the sequence accessed via an iterator initialized via the
99  // assignment operator (as opposed to a copy constructor) matches
100  // just the same.
101  it = generator.begin();
102  for (size_t i = 0; i < N; ++i) {
103  ASSERT_FALSE(it == generator.end())
104  << "At element " << i << " when accessing via an iterator "
105  << "created with the assignment operator.\n";
106  EXPECT_TRUE(expected_values[i] == *it)
107  << "where i is " << i
108  << ", expected_values[i] is " << PrintValue(expected_values[i])
109  << ", *it is " << PrintValue(*it)
110  << ", and 'it' is an iterator created with the copy constructor.\n";
111  ++it;
112  }
113  EXPECT_TRUE(it == generator.end())
114  << "At the presumed end of sequence when accessing via an iterator "
115  << "created with the assignment operator.\n";
116 }
117 
118 template <typename T>
119 void VerifyGeneratorIsEmpty(const ParamGenerator<T>& generator) {
120  typename ParamGenerator<T>::iterator it = generator.begin();
121  EXPECT_TRUE(it == generator.end());
122 
123  it = generator.begin();
124  EXPECT_TRUE(it == generator.end());
125 }
126 
127 // Generator tests. They test that each of the provided generator functions
128 // generates an expected sequence of values. The general test pattern
129 // instantiates a generator using one of the generator functions,
130 // checks the sequence produced by the generator using its iterator API,
131 // and then resets the iterator back to the beginning of the sequence
132 // and checks the sequence again.
133 
134 // Tests that iterators produced by generator functions conform to the
135 // ForwardIterator concept.
136 TEST(IteratorTest, ParamIteratorConformsToForwardIteratorConcept) {
137  const ParamGenerator<int> gen = Range(0, 10);
138  ParamGenerator<int>::iterator it = gen.begin();
139 
140  // Verifies that iterator initialization works as expected.
141  ParamGenerator<int>::iterator it2 = it;
142  EXPECT_TRUE(*it == *it2) << "Initialized iterators must point to the "
143  << "element same as its source points to";
144 
145  // Verifies that iterator assignment works as expected.
146  ++it;
147  EXPECT_FALSE(*it == *it2);
148  it2 = it;
149  EXPECT_TRUE(*it == *it2) << "Assigned iterators must point to the "
150  << "element same as its source points to";
151 
152  // Verifies that prefix operator++() returns *this.
153  EXPECT_EQ(&it, &(++it)) << "Result of the prefix operator++ must be "
154  << "refer to the original object";
155 
156  // Verifies that the result of the postfix operator++ points to the value
157  // pointed to by the original iterator.
158  int original_value = *it; // Have to compute it outside of macro call to be
159  // unaffected by the parameter evaluation order.
160  EXPECT_EQ(original_value, *(it++));
161 
162  // Verifies that prefix and postfix operator++() advance an iterator
163  // all the same.
164  it2 = it;
165  ++it;
166  ++it2;
167  EXPECT_TRUE(*it == *it2);
168 }
169 
170 // Tests that Range() generates the expected sequence.
171 TEST(RangeTest, IntRangeWithDefaultStep) {
172  const ParamGenerator<int> gen = Range(0, 3);
173  const int expected_values[] = {0, 1, 2};
174  VerifyGenerator(gen, expected_values);
175 }
176 
177 // Edge case. Tests that Range() generates the single element sequence
178 // as expected when provided with range limits that are equal.
179 TEST(RangeTest, IntRangeSingleValue) {
180  const ParamGenerator<int> gen = Range(0, 1);
181  const int expected_values[] = {0};
182  VerifyGenerator(gen, expected_values);
183 }
184 
185 // Edge case. Tests that Range() with generates empty sequence when
186 // supplied with an empty range.
187 TEST(RangeTest, IntRangeEmpty) {
188  const ParamGenerator<int> gen = Range(0, 0);
190 }
191 
192 // Tests that Range() with custom step (greater then one) generates
193 // the expected sequence.
194 TEST(RangeTest, IntRangeWithCustomStep) {
195  const ParamGenerator<int> gen = Range(0, 9, 3);
196  const int expected_values[] = {0, 3, 6};
197  VerifyGenerator(gen, expected_values);
198 }
199 
200 // Tests that Range() with custom step (greater then one) generates
201 // the expected sequence when the last element does not fall on the
202 // upper range limit. Sequences generated by Range() must not have
203 // elements beyond the range limits.
204 TEST(RangeTest, IntRangeWithCustomStepOverUpperBound) {
205  const ParamGenerator<int> gen = Range(0, 4, 3);
206  const int expected_values[] = {0, 3};
207  VerifyGenerator(gen, expected_values);
208 }
209 
210 // Verifies that Range works with user-defined types that define
211 // copy constructor, operator=(), operator+(), and operator<().
212 class DogAdder {
213  public:
214  explicit DogAdder(const char* a_value) : value_(a_value) {}
215  DogAdder(const DogAdder& other) : value_(other.value_.c_str()) {}
216 
217  DogAdder operator=(const DogAdder& other) {
218  if (this != &other)
219  value_ = other.value_;
220  return *this;
221  }
222  DogAdder operator+(const DogAdder& other) const {
223  Message msg;
224  msg << value_.c_str() << other.value_.c_str();
225  return DogAdder(msg.GetString().c_str());
226  }
227  bool operator<(const DogAdder& other) const {
228  return value_ < other.value_;
229  }
230  const std::string& value() const { return value_; }
231 
232  private:
234 };
235 
236 TEST(RangeTest, WorksWithACustomType) {
237  const ParamGenerator<DogAdder> gen =
238  Range(DogAdder("cat"), DogAdder("catdogdog"), DogAdder("dog"));
239  ParamGenerator<DogAdder>::iterator it = gen.begin();
240 
241  ASSERT_FALSE(it == gen.end());
242  EXPECT_STREQ("cat", it->value().c_str());
243 
244  ASSERT_FALSE(++it == gen.end());
245  EXPECT_STREQ("catdog", it->value().c_str());
246 
247  EXPECT_TRUE(++it == gen.end());
248 }
249 
250 class IntWrapper {
251  public:
252  explicit IntWrapper(int a_value) : value_(a_value) {}
253  IntWrapper(const IntWrapper& other) : value_(other.value_) {}
254 
256  value_ = other.value_;
257  return *this;
258  }
259  // operator+() adds a different type.
260  IntWrapper operator+(int other) const { return IntWrapper(value_ + other); }
261  bool operator<(const IntWrapper& other) const {
262  return value_ < other.value_;
263  }
264  int value() const { return value_; }
265 
266  private:
267  int value_;
268 };
269 
270 TEST(RangeTest, WorksWithACustomTypeWithDifferentIncrementType) {
271  const ParamGenerator<IntWrapper> gen = Range(IntWrapper(0), IntWrapper(2));
272  ParamGenerator<IntWrapper>::iterator it = gen.begin();
273 
274  ASSERT_FALSE(it == gen.end());
275  EXPECT_EQ(0, it->value());
276 
277  ASSERT_FALSE(++it == gen.end());
278  EXPECT_EQ(1, it->value());
279 
280  EXPECT_TRUE(++it == gen.end());
281 }
282 
283 // Tests that ValuesIn() with an array parameter generates
284 // the expected sequence.
285 TEST(ValuesInTest, ValuesInArray) {
286  int array[] = {3, 5, 8};
287  const ParamGenerator<int> gen = ValuesIn(array);
288  VerifyGenerator(gen, array);
289 }
290 
291 // Tests that ValuesIn() with a const array parameter generates
292 // the expected sequence.
293 TEST(ValuesInTest, ValuesInConstArray) {
294  const int array[] = {3, 5, 8};
295  const ParamGenerator<int> gen = ValuesIn(array);
296  VerifyGenerator(gen, array);
297 }
298 
299 // Edge case. Tests that ValuesIn() with an array parameter containing a
300 // single element generates the single element sequence.
301 TEST(ValuesInTest, ValuesInSingleElementArray) {
302  int array[] = {42};
303  const ParamGenerator<int> gen = ValuesIn(array);
304  VerifyGenerator(gen, array);
305 }
306 
307 // Tests that ValuesIn() generates the expected sequence for an STL
308 // container (vector).
309 TEST(ValuesInTest, ValuesInVector) {
310  typedef ::std::vector<int> ContainerType;
311  ContainerType values;
312  values.push_back(3);
313  values.push_back(5);
314  values.push_back(8);
315  const ParamGenerator<int> gen = ValuesIn(values);
316 
317  const int expected_values[] = {3, 5, 8};
318  VerifyGenerator(gen, expected_values);
319 }
320 
321 // Tests that ValuesIn() generates the expected sequence.
322 TEST(ValuesInTest, ValuesInIteratorRange) {
323  typedef ::std::vector<int> ContainerType;
324  ContainerType values;
325  values.push_back(3);
326  values.push_back(5);
327  values.push_back(8);
328  const ParamGenerator<int> gen = ValuesIn(values.begin(), values.end());
329 
330  const int expected_values[] = {3, 5, 8};
331  VerifyGenerator(gen, expected_values);
332 }
333 
334 // Edge case. Tests that ValuesIn() provided with an iterator range specifying a
335 // single value generates a single-element sequence.
336 TEST(ValuesInTest, ValuesInSingleElementIteratorRange) {
337  typedef ::std::vector<int> ContainerType;
338  ContainerType values;
339  values.push_back(42);
340  const ParamGenerator<int> gen = ValuesIn(values.begin(), values.end());
341 
342  const int expected_values[] = {42};
343  VerifyGenerator(gen, expected_values);
344 }
345 
346 // Edge case. Tests that ValuesIn() provided with an empty iterator range
347 // generates an empty sequence.
348 TEST(ValuesInTest, ValuesInEmptyIteratorRange) {
349  typedef ::std::vector<int> ContainerType;
350  ContainerType values;
351  const ParamGenerator<int> gen = ValuesIn(values.begin(), values.end());
352 
354 }
355 
356 // Tests that the Values() generates the expected sequence.
357 TEST(ValuesTest, ValuesWorks) {
358  const ParamGenerator<int> gen = Values(3, 5, 8);
359 
360  const int expected_values[] = {3, 5, 8};
361  VerifyGenerator(gen, expected_values);
362 }
363 
364 // Tests that Values() generates the expected sequences from elements of
365 // different types convertible to ParamGenerator's parameter type.
366 TEST(ValuesTest, ValuesWorksForValuesOfCompatibleTypes) {
367  const ParamGenerator<double> gen = Values(3, 5.0f, 8.0);
368 
369  const double expected_values[] = {3.0, 5.0, 8.0};
370  VerifyGenerator(gen, expected_values);
371 }
372 
373 TEST(ValuesTest, ValuesWorksForMaxLengthList) {
374  const ParamGenerator<int> gen = Values(
375  10, 20, 30, 40, 50, 60, 70, 80, 90, 100,
376  110, 120, 130, 140, 150, 160, 170, 180, 190, 200,
377  210, 220, 230, 240, 250, 260, 270, 280, 290, 300,
378  310, 320, 330, 340, 350, 360, 370, 380, 390, 400,
379  410, 420, 430, 440, 450, 460, 470, 480, 490, 500);
380 
381  const int expected_values[] = {
382  10, 20, 30, 40, 50, 60, 70, 80, 90, 100,
383  110, 120, 130, 140, 150, 160, 170, 180, 190, 200,
384  210, 220, 230, 240, 250, 260, 270, 280, 290, 300,
385  310, 320, 330, 340, 350, 360, 370, 380, 390, 400,
386  410, 420, 430, 440, 450, 460, 470, 480, 490, 500};
387  VerifyGenerator(gen, expected_values);
388 }
389 
390 // Edge case test. Tests that single-parameter Values() generates the sequence
391 // with the single value.
392 TEST(ValuesTest, ValuesWithSingleParameter) {
393  const ParamGenerator<int> gen = Values(42);
394 
395  const int expected_values[] = {42};
396  VerifyGenerator(gen, expected_values);
397 }
398 
399 // Tests that Bool() generates sequence (false, true).
400 TEST(BoolTest, BoolWorks) {
401  const ParamGenerator<bool> gen = Bool();
402 
403  const bool expected_values[] = {false, true};
404  VerifyGenerator(gen, expected_values);
405 }
406 
407 // Tests that Combine() with two parameters generates the expected sequence.
408 TEST(CombineTest, CombineWithTwoParameters) {
409  const char* foo = "foo";
410  const char* bar = "bar";
411  const ParamGenerator<std::tuple<const char*, int> > gen =
412  Combine(Values(foo, bar), Values(3, 4));
413 
414  std::tuple<const char*, int> expected_values[] = {
415  std::make_tuple(foo, 3), std::make_tuple(foo, 4), std::make_tuple(bar, 3),
416  std::make_tuple(bar, 4)};
417  VerifyGenerator(gen, expected_values);
418 }
419 
420 // Tests that Combine() with three parameters generates the expected sequence.
421 TEST(CombineTest, CombineWithThreeParameters) {
422  const ParamGenerator<std::tuple<int, int, int> > gen =
423  Combine(Values(0, 1), Values(3, 4), Values(5, 6));
424  std::tuple<int, int, int> expected_values[] = {
425  std::make_tuple(0, 3, 5), std::make_tuple(0, 3, 6),
426  std::make_tuple(0, 4, 5), std::make_tuple(0, 4, 6),
427  std::make_tuple(1, 3, 5), std::make_tuple(1, 3, 6),
428  std::make_tuple(1, 4, 5), std::make_tuple(1, 4, 6)};
429  VerifyGenerator(gen, expected_values);
430 }
431 
432 // Tests that the Combine() with the first parameter generating a single value
433 // sequence generates a sequence with the number of elements equal to the
434 // number of elements in the sequence generated by the second parameter.
435 TEST(CombineTest, CombineWithFirstParameterSingleValue) {
436  const ParamGenerator<std::tuple<int, int> > gen =
437  Combine(Values(42), Values(0, 1));
438 
439  std::tuple<int, int> expected_values[] = {std::make_tuple(42, 0),
440  std::make_tuple(42, 1)};
441  VerifyGenerator(gen, expected_values);
442 }
443 
444 // Tests that the Combine() with the second parameter generating a single value
445 // sequence generates a sequence with the number of elements equal to the
446 // number of elements in the sequence generated by the first parameter.
447 TEST(CombineTest, CombineWithSecondParameterSingleValue) {
448  const ParamGenerator<std::tuple<int, int> > gen =
449  Combine(Values(0, 1), Values(42));
450 
451  std::tuple<int, int> expected_values[] = {std::make_tuple(0, 42),
452  std::make_tuple(1, 42)};
453  VerifyGenerator(gen, expected_values);
454 }
455 
456 // Tests that when the first parameter produces an empty sequence,
457 // Combine() produces an empty sequence, too.
458 TEST(CombineTest, CombineWithFirstParameterEmptyRange) {
459  const ParamGenerator<std::tuple<int, int> > gen =
460  Combine(Range(0, 0), Values(0, 1));
462 }
463 
464 // Tests that when the second parameter produces an empty sequence,
465 // Combine() produces an empty sequence, too.
466 TEST(CombineTest, CombineWithSecondParameterEmptyRange) {
467  const ParamGenerator<std::tuple<int, int> > gen =
468  Combine(Values(0, 1), Range(1, 1));
470 }
471 
472 // Edge case. Tests that combine works with the maximum number
473 // of parameters supported by Google Test (currently 10).
474 TEST(CombineTest, CombineWithMaxNumberOfParameters) {
475  const char* foo = "foo";
476  const char* bar = "bar";
477  const ParamGenerator<
478  std::tuple<const char*, int, int, int, int, int, int, int, int, int> >
479  gen =
480  Combine(Values(foo, bar), Values(1), Values(2), Values(3), Values(4),
481  Values(5), Values(6), Values(7), Values(8), Values(9));
482 
483  std::tuple<const char*, int, int, int, int, int, int, int, int, int>
484  expected_values[] = {std::make_tuple(foo, 1, 2, 3, 4, 5, 6, 7, 8, 9),
485  std::make_tuple(bar, 1, 2, 3, 4, 5, 6, 7, 8, 9)};
486  VerifyGenerator(gen, expected_values);
487 }
488 
490  public:
492 
493  const std::string& str() const { return str_; }
494 
495  private:
497 
498  // Not default constructible
500  // Not assignable
502 };
503 
504 TEST(CombineTest, NonDefaultConstructAssign) {
505  const ParamGenerator<std::tuple<int, NonDefaultConstructAssignString> > gen =
508 
509  ParamGenerator<std::tuple<int, NonDefaultConstructAssignString> >::iterator
510  it = gen.begin();
511 
512  EXPECT_EQ(0, std::get<0>(*it));
513  EXPECT_EQ("A", std::get<1>(*it).str());
514  ++it;
515 
516  EXPECT_EQ(0, std::get<0>(*it));
517  EXPECT_EQ("B", std::get<1>(*it).str());
518  ++it;
519 
520  EXPECT_EQ(1, std::get<0>(*it));
521  EXPECT_EQ("A", std::get<1>(*it).str());
522  ++it;
523 
524  EXPECT_EQ(1, std::get<0>(*it));
525  EXPECT_EQ("B", std::get<1>(*it).str());
526  ++it;
527 
528  EXPECT_TRUE(it == gen.end());
529 }
530 
531 
532 // Tests that an generator produces correct sequence after being
533 // assigned from another generator.
534 TEST(ParamGeneratorTest, AssignmentWorks) {
535  ParamGenerator<int> gen = Values(1, 2);
536  const ParamGenerator<int> gen2 = Values(3, 4);
537  gen = gen2;
538 
539  const int expected_values[] = {3, 4};
540  VerifyGenerator(gen, expected_values);
541 }
542 
543 // This test verifies that the tests are expanded and run as specified:
544 // one test per element from the sequence produced by the generator
545 // specified in INSTANTIATE_TEST_SUITE_P. It also verifies that the test's
546 // fixture constructor, SetUp(), and TearDown() have run and have been
547 // supplied with the correct parameters.
548 
549 // The use of environment object allows detection of the case where no test
550 // case functionality is run at all. In this case TearDownTestSuite will not
551 // be able to detect missing tests, naturally.
552 template <int kExpectedCalls>
554  public:
557  return instance;
558  }
559 
564 
565  void TearDown() override {
566  // If all MultipleTestGenerationTest tests have been de-selected
567  // by the filter flag, the following checks make no sense.
568  bool perform_check = false;
569 
570  for (int i = 0; i < kExpectedCalls; ++i) {
571  Message msg;
572  msg << "TestsExpandedAndRun/" << i;
573  if (UnitTestOptions::FilterMatchesTest(
574  "TestExpansionModule/MultipleTestGenerationTest",
575  msg.GetString().c_str())) {
576  perform_check = true;
577  }
578  }
579  if (perform_check) {
580  EXPECT_EQ(kExpectedCalls, fixture_constructor_count_)
581  << "Fixture constructor of ParamTestGenerationTest test case "
582  << "has not been run as expected.";
583  EXPECT_EQ(kExpectedCalls, set_up_count_)
584  << "Fixture SetUp method of ParamTestGenerationTest test case "
585  << "has not been run as expected.";
586  EXPECT_EQ(kExpectedCalls, tear_down_count_)
587  << "Fixture TearDown method of ParamTestGenerationTest test case "
588  << "has not been run as expected.";
589  EXPECT_EQ(kExpectedCalls, test_body_count_)
590  << "Test in ParamTestGenerationTest test case "
591  << "has not been run as expected.";
592  }
593  }
594 
595  private:
598 
603 
605 };
606 
607 const int test_generation_params[] = {36, 42, 72};
608 
609 class TestGenerationTest : public TestWithParam<int> {
610  public:
611  enum {
614  };
615 
617 
621  }
622  void SetUp() override {
625  }
626  void TearDown() override {
629  }
630 
631  static void SetUpTestSuite() {
632  bool all_tests_in_test_case_selected = true;
633 
634  for (int i = 0; i < PARAMETER_COUNT; ++i) {
635  Message test_name;
636  test_name << "TestsExpandedAndRun/" << i;
637  if ( !UnitTestOptions::FilterMatchesTest(
638  "TestExpansionModule/MultipleTestGenerationTest",
639  test_name.GetString())) {
640  all_tests_in_test_case_selected = false;
641  }
642  }
643  EXPECT_TRUE(all_tests_in_test_case_selected)
644  << "When running the TestGenerationTest test case all of its tests\n"
645  << "must be selected by the filter flag for the test case to pass.\n"
646  << "If not all of them are enabled, we can't reliably conclude\n"
647  << "that the correct number of tests have been generated.";
648 
649  collected_parameters_.clear();
650  }
651 
652  static void TearDownTestSuite() {
653  vector<int> expected_values(test_generation_params,
655  // Test execution order is not guaranteed by Google Test,
656  // so the order of values in collected_parameters_ can be
657  // different and we have to sort to compare.
658  sort(expected_values.begin(), expected_values.end());
659  sort(collected_parameters_.begin(), collected_parameters_.end());
660 
661  EXPECT_TRUE(collected_parameters_ == expected_values);
662  }
663 
664  protected:
666  static vector<int> collected_parameters_;
667 
668  private:
670 };
672 
673 TEST_P(TestGenerationTest, TestsExpandedAndRun) {
674  Environment::Instance()->TestBodyExecuted();
675  EXPECT_EQ(current_parameter_, GetParam());
676  collected_parameters_.push_back(GetParam());
677 }
678 INSTANTIATE_TEST_SUITE_P(TestExpansionModule, TestGenerationTest,
680 
681 // This test verifies that the element sequence (third parameter of
682 // INSTANTIATE_TEST_SUITE_P) is evaluated in InitGoogleTest() and neither at
683 // the call site of INSTANTIATE_TEST_SUITE_P nor in RUN_ALL_TESTS(). For
684 // that, we declare param_value_ to be a static member of
685 // GeneratorEvaluationTest and initialize it to 0. We set it to 1 in
686 // main(), just before invocation of InitGoogleTest(). After calling
687 // InitGoogleTest(), we set the value to 2. If the sequence is evaluated
688 // before or after InitGoogleTest, INSTANTIATE_TEST_SUITE_P will create a
689 // test with parameter other than 1, and the test body will fail the
690 // assertion.
691 class GeneratorEvaluationTest : public TestWithParam<int> {
692  public:
693  static int param_value() { return param_value_; }
695 
696  private:
697  static int param_value_;
698 };
700 
701 TEST_P(GeneratorEvaluationTest, GeneratorsEvaluatedInMain) {
702  EXPECT_EQ(1, GetParam());
703 }
706 
707 // Tests that generators defined in a different translation unit are
708 // functional. Generator extern_gen is defined in gtest-param-test_test2.cc.
709 extern ParamGenerator<int> extern_gen;
710 class ExternalGeneratorTest : public TestWithParam<int> {};
711 TEST_P(ExternalGeneratorTest, ExternalGenerator) {
712  // Sequence produced by extern_gen contains only a single value
713  // which we verify here.
714  EXPECT_EQ(GetParam(), 33);
715 }
716 INSTANTIATE_TEST_SUITE_P(ExternalGeneratorModule, ExternalGeneratorTest,
717  extern_gen);
718 
719 // Tests that a parameterized test case can be defined in one translation
720 // unit and instantiated in another. This test will be instantiated in
721 // gtest-param-test_test2.cc. ExternalInstantiationTest fixture class is
722 // defined in gtest-param-test_test.h.
724  EXPECT_EQ(0, GetParam() % 33);
725 }
726 
727 // Tests that a parameterized test case can be instantiated with multiple
728 // generators.
729 class MultipleInstantiationTest : public TestWithParam<int> {};
730 TEST_P(MultipleInstantiationTest, AllowsMultipleInstances) {
731 }
734 
735 // Tests that a parameterized test case can be instantiated
736 // in multiple translation units. This test will be instantiated
737 // here and in gtest-param-test_test2.cc.
738 // InstantiationInMultipleTranslationUnitsTest fixture class
739 // is defined in gtest-param-test_test.h.
741  EXPECT_EQ(0, GetParam() % 42);
742 }
744  Values(42, 42 * 2));
745 
746 // Tests that each iteration of parameterized test runs in a separate test
747 // object.
748 class SeparateInstanceTest : public TestWithParam<int> {
749  public:
751 
752  static void TearDownTestSuite() {
754  << "If some (but not all) SeparateInstanceTest tests have been "
755  << "filtered out this test will fail. Make sure that all "
756  << "GeneratorEvaluationTest are selected or de-selected together "
757  << "by the test filter.";
758  }
759 
760  protected:
761  int count_;
762  static int global_count_;
763 };
765 
766 TEST_P(SeparateInstanceTest, TestsRunInSeparateInstances) {
767  EXPECT_EQ(0, count_++);
768  global_count_++;
769 }
770 INSTANTIATE_TEST_SUITE_P(FourElemSequence, SeparateInstanceTest, Range(1, 4));
771 
772 // Tests that all instantiations of a test have named appropriately. Test
773 // defined with TEST_P(TestSuiteName, TestName) and instantiated with
774 // INSTANTIATE_TEST_SUITE_P(SequenceName, TestSuiteName, generator) must be
775 // named SequenceName/TestSuiteName.TestName/i, where i is the 0-based index of
776 // the sequence element used to instantiate the test.
777 class NamingTest : public TestWithParam<int> {};
778 
779 TEST_P(NamingTest, TestsReportCorrectNamesAndParameters) {
780  const ::testing::TestInfo* const test_info =
782 
783  EXPECT_STREQ("ZeroToFiveSequence/NamingTest", test_info->test_suite_name());
784 
785  Message index_stream;
786  index_stream << "TestsReportCorrectNamesAndParameters/" << GetParam();
787  EXPECT_STREQ(index_stream.GetString().c_str(), test_info->name());
788 
789  EXPECT_EQ(::testing::PrintToString(GetParam()), test_info->value_param());
790 }
791 
792 INSTANTIATE_TEST_SUITE_P(ZeroToFiveSequence, NamingTest, Range(0, 5));
793 
794 // Tests that macros in test names are expanded correctly.
795 class MacroNamingTest : public TestWithParam<int> {};
796 
797 #define PREFIX_WITH_FOO(test_name) Foo##test_name
798 #define PREFIX_WITH_MACRO(test_name) Macro##test_name
799 
801  const ::testing::TestInfo* const test_info =
803 
804  EXPECT_STREQ("FortyTwo/MacroNamingTest", test_info->test_suite_name());
805  EXPECT_STREQ("FooSomeTestName", test_info->name());
806 }
807 
809 
810 // Tests the same thing for non-parametrized tests.
812 
813 TEST_F(PREFIX_WITH_MACRO(NamingTestNonParametrized),
814  PREFIX_WITH_FOO(SomeTestName)) {
815  const ::testing::TestInfo* const test_info =
817 
818  EXPECT_STREQ("MacroNamingTestNonParametrized", test_info->test_suite_name());
819  EXPECT_STREQ("FooSomeTestName", test_info->name());
820 }
821 
822 // Tests that user supplied custom parameter names are working correctly.
823 // Runs the test with a builtin helper method which uses PrintToString,
824 // as well as a custom function and custom functor to ensure all possible
825 // uses work correctly.
826 class CustomFunctorNamingTest : public TestWithParam<std::string> {};
827 TEST_P(CustomFunctorNamingTest, CustomTestNames) {}
828 
830  std::string operator()(const ::testing::TestParamInfo<std::string>& inf) {
831  return inf.param;
832  }
833 };
834 
836  Values(std::string("FunctorName")),
838 
840  Values("abcdefghijklmnopqrstuvwxyz",
841  "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "01234567890_"),
843 
845  const ::testing::TestParamInfo<std::string>& inf) {
846  return inf.param;
847 }
848 
849 class CustomFunctionNamingTest : public TestWithParam<std::string> {};
850 TEST_P(CustomFunctionNamingTest, CustomTestNames) {}
851 
853  Values(std::string("FunctionName")),
855 
856 // Test custom naming with a lambda
857 
858 class CustomLambdaNamingTest : public TestWithParam<std::string> {};
859 TEST_P(CustomLambdaNamingTest, CustomTestNames) {}
860 
861 INSTANTIATE_TEST_SUITE_P(CustomParamNameLambda, CustomLambdaNamingTest,
862  Values(std::string("LambdaName")),
863  [](const ::testing::TestParamInfo<std::string>& inf) {
864  return inf.param;
865  });
866 
867 TEST(CustomNamingTest, CheckNameRegistry) {
869  std::set<std::string> test_names;
870  for (int suite_num = 0; suite_num < unit_test->total_test_suite_count();
871  ++suite_num) {
872  const ::testing::TestSuite* test_suite = unit_test->GetTestSuite(suite_num);
873  for (int test_num = 0; test_num < test_suite->total_test_count();
874  ++test_num) {
875  const ::testing::TestInfo* test_info = test_suite->GetTestInfo(test_num);
876  test_names.insert(std::string(test_info->name()));
877  }
878  }
879  EXPECT_EQ(1u, test_names.count("CustomTestNames/FunctorName"));
880  EXPECT_EQ(1u, test_names.count("CustomTestNames/FunctionName"));
881  EXPECT_EQ(1u, test_names.count("CustomTestNames/LambdaName"));
882 }
883 
884 // Test a numeric name to ensure PrintToStringParamName works correctly.
885 
886 class CustomIntegerNamingTest : public TestWithParam<int> {};
887 
888 TEST_P(CustomIntegerNamingTest, TestsReportCorrectNames) {
889  const ::testing::TestInfo* const test_info =
891  Message test_name_stream;
892  test_name_stream << "TestsReportCorrectNames/" << GetParam();
893  EXPECT_STREQ(test_name_stream.GetString().c_str(), test_info->name());
894 }
895 
898 
899 // Test a custom struct with PrintToString.
900 
901 struct CustomStruct {
902  explicit CustomStruct(int value) : x(value) {}
903  int x;
904 };
905 
906 std::ostream& operator<<(std::ostream& stream, const CustomStruct& val) {
907  stream << val.x;
908  return stream;
909 }
910 
911 class CustomStructNamingTest : public TestWithParam<CustomStruct> {};
912 
913 TEST_P(CustomStructNamingTest, TestsReportCorrectNames) {
914  const ::testing::TestInfo* const test_info =
916  Message test_name_stream;
917  test_name_stream << "TestsReportCorrectNames/" << GetParam();
918  EXPECT_STREQ(test_name_stream.GetString().c_str(), test_info->name());
919 }
920 
924 
925 // Test that using a stateful parameter naming function works as expected.
926 
929  std::string operator()(const ::testing::TestParamInfo<int>& info) {
930  int value = info.param + sum;
931  sum += info.param;
933  }
934  int sum;
935 };
936 
938  protected:
940  int sum_;
941 };
942 
943 TEST_P(StatefulNamingTest, TestsReportCorrectNames) {
944  const ::testing::TestInfo* const test_info =
946  sum_ += GetParam();
947  Message test_name_stream;
948  test_name_stream << "TestsReportCorrectNames/" << sum_;
949  EXPECT_STREQ(test_name_stream.GetString().c_str(), test_info->name());
950 }
951 
954 
955 // Class that cannot be streamed into an ostream. It needs to be copyable
956 // (and, in case of MSVC, also assignable) in order to be a test parameter
957 // type. Its default copy constructor and assignment operator do exactly
958 // what we need.
960  public:
961  explicit Unstreamable(int value) : value_(value) {}
962 
963  private:
964  int value_;
965 };
966 
967 class CommentTest : public TestWithParam<Unstreamable> {};
968 
969 TEST_P(CommentTest, TestsCorrectlyReportUnstreamableParams) {
970  const ::testing::TestInfo* const test_info =
972 
973  EXPECT_EQ(::testing::PrintToString(GetParam()), test_info->value_param());
974 }
975 
976 INSTANTIATE_TEST_SUITE_P(InstantiationWithComments, CommentTest,
977  Values(Unstreamable(1)));
978 
979 // Verify that we can create a hierarchy of test fixtures, where the base
980 // class fixture is not parameterized and the derived class is. In this case
981 // ParameterizedDerivedTest inherits from NonParameterizedBaseTest. We
982 // perform simple tests on both.
984  public:
986  protected:
987  int n_;
988 };
989 
991  public ::testing::WithParamInterface<int> {
992  protected:
994  int count_;
995  static int global_count_;
996 };
997 
999 
1000 TEST_F(NonParameterizedBaseTest, FixtureIsInitialized) {
1001  EXPECT_EQ(17, n_);
1002 }
1003 
1005  EXPECT_EQ(17, n_);
1006  EXPECT_EQ(0, count_++);
1007  EXPECT_EQ(GetParam(), global_count_++);
1008 }
1009 
1011 
1012 TEST_F(ParameterizedDeathTest, GetParamDiesFromTestF) {
1013  EXPECT_DEATH_IF_SUPPORTED(GetParam(),
1014  ".* value-parameterized test .*");
1015 }
1016 
1018  Range(0, 5));
1019 
1020 // Tests param generator working with Enums
1021 enum MyEnums {
1022  ENUM1 = 1,
1023  ENUM2 = 3,
1024  ENUM3 = 8,
1025 };
1026 
1027 class MyEnumTest : public testing::TestWithParam<MyEnums> {};
1028 
1029 TEST_P(MyEnumTest, ChecksParamMoreThanZero) { EXPECT_GE(10, GetParam()); }
1031  ::testing::Values(ENUM1, ENUM2, 0));
1032 
1033 int main(int argc, char **argv) {
1034  // Used in TestGenerationTest test suite.
1036  // Used in GeneratorEvaluationTest test suite. Tests that the updated value
1037  // will be picked up for instantiating tests in GeneratorEvaluationTest.
1039 
1040  ::testing::InitGoogleTest(&argc, argv);
1041 
1042  // Used in GeneratorEvaluationTest test suite. Tests that value updated
1043  // here will NOT be used for instantiating tests in
1044  // GeneratorEvaluationTest.
1046 
1047  return RUN_ALL_TESTS();
1048 }
TestGenerationEnvironment::tear_down_count_
int tear_down_count_
Definition: googletest-param-test-test.cc:601
TestGenerationTest::Environment
TestGenerationEnvironment< PARAMETER_COUNT > Environment
Definition: googletest-param-test-test.cc:616
NonDefaultConstructAssignString::str
const std::string & str() const
Definition: googletest-param-test-test.cc:493
DogAdder::operator+
DogAdder operator+(const DogAdder &other) const
Definition: googletest-param-test-test.cc:222
StatefulNamingFunctor::operator()
std::string operator()(const ::testing::TestParamInfo< int > &info)
Definition: googletest-param-test-test.cc:929
TestGenerationEnvironment::FixtureConstructorExecuted
void FixtureConstructorExecuted()
Definition: googletest-param-test-test.cc:560
MyEnumTest
Definition: googletest-param-test-test.cc:1027
ASSERT_FALSE
#define ASSERT_FALSE(condition)
Definition: gtest.h:1998
EXPECT_GE
#define EXPECT_GE(val1, val2)
Definition: gtest.h:2058
ParameterizedDerivedTest
Definition: googletest-param-test-test.cc:990
IntWrapper::value
int value() const
Definition: googletest-param-test-test.cc:264
IntWrapper::IntWrapper
IntWrapper(const IntWrapper &other)
Definition: googletest-param-test-test.cc:253
DogAdder
Definition: googletest-param-test-test.cc:212
SeparateInstanceTest::count_
int count_
Definition: googletest-param-test-test.cc:761
TestGenerationTest::GTEST_DISALLOW_COPY_AND_ASSIGN_
GTEST_DISALLOW_COPY_AND_ASSIGN_(TestGenerationTest)
operator<<
std::ostream & operator<<(std::ostream &stream, const CustomStruct &val)
Definition: googletest-param-test-test.cc:906
testing::WithParamInterface
Definition: gtest.h:1875
IntWrapper::IntWrapper
IntWrapper(int a_value)
Definition: googletest-param-test-test.cc:252
testing::UnitTest::total_test_suite_count
int total_test_suite_count() const
Definition: gtest.cc:4563
testing::UnitTest::current_test_info
const TestInfo * current_test_info() const GTEST_LOCK_EXCLUDED_(mutex_)
Definition: gtest.cc:4874
SeparateInstanceTest::SeparateInstanceTest
SeparateInstanceTest()
Definition: googletest-param-test-test.cc:750
InstantiationInMultipleTranslationUnitsTest
Definition: googletest-param-test-test.h:47
DogAdder::operator<
bool operator<(const DogAdder &other) const
Definition: googletest-param-test-test.cc:227
stream
GLuint GLuint stream
Definition: glcorearb.h:3946
INSTANTIATE_TEST_SUITE_P
INSTANTIATE_TEST_SUITE_P(TestExpansionModule, TestGenerationTest, ValuesIn(test_generation_params))
ENUM3
@ ENUM3
Definition: googletest-param-test-test.cc:1024
gtest-internal-inl.h
gtest.h
bar
Definition: googletest-output-test_.cc:550
ParameterizedDerivedTest::ParameterizedDerivedTest
ParameterizedDerivedTest()
Definition: googletest-param-test-test.cc:993
NamingTest
Definition: googletest-param-test-test.cc:777
DogAdder::operator=
DogAdder operator=(const DogAdder &other)
Definition: googletest-param-test-test.cc:217
s
XmlRpcServer s
NonDefaultConstructAssignString
Definition: googletest-param-test-test.cc:489
TestGenerationTest::TearDown
void TearDown() override
Definition: googletest-param-test-test.cc:626
EXPECT_EQ
#define EXPECT_EQ(val1, val2)
Definition: glog/src/googletest.h:155
StatefulNamingTest::sum_
int sum_
Definition: googletest-param-test-test.cc:940
main
int main(int argc, char **argv)
Definition: googletest-param-test-test.cc:1033
ExternalInstantiationTest
Definition: googletest-param-test-test.h:42
InitGoogleTest
_START_GOOGLE_NAMESPACE_ void InitGoogleTest(int *, char **)
Definition: glog/src/googletest.h:124
foo
Definition: googletest-output-test_.cc:534
string
GLsizei const GLchar *const * string
Definition: glcorearb.h:3083
TestGenerationEnvironment::TearDownExecuted
void TearDownExecuted()
Definition: googletest-param-test-test.cc:562
CustomParamNameFunctor::operator()
std::string operator()(const ::testing::TestParamInfo< std::string > &inf)
Definition: googletest-param-test-test.cc:830
googletest-param-test-test.h
TestGenerationEnvironment::TestGenerationEnvironment
TestGenerationEnvironment()
Definition: googletest-param-test-test.cc:596
TestGenerationEnvironment::Instance
static TestGenerationEnvironment * Instance()
Definition: googletest-param-test-test.cc:555
TestGenerationEnvironment::SetUpExecuted
void SetUpExecuted()
Definition: googletest-param-test-test.cc:561
SeparateInstanceTest
Definition: googletest-param-test-test.cc:748
x
GLint GLenum GLint x
Definition: glcorearb.h:2834
DogAdder::DogAdder
DogAdder(const char *a_value)
Definition: googletest-param-test-test.cc:214
T
#define T(upbtypeconst, upbtype, ctype, default_value)
TestGenerationEnvironment::TearDown
void TearDown() override
Definition: googletest-param-test-test.cc:565
testing::Combine
internal::CartesianProductHolder2< Generator1, Generator2 > Combine(const Generator1 &g1, const Generator2 &g2)
Definition: gtest-param-test.h:415
IntWrapper::operator<
bool operator<(const IntWrapper &other) const
Definition: googletest-param-test-test.cc:261
testing::Test
Definition: gtest.h:415
CustomFunctionNamingTest
Definition: googletest-param-test-test.cc:849
TestGenerationEnvironment::test_body_count_
int test_body_count_
Definition: googletest-param-test-test.cc:602
testing::TestWithParam
Definition: gtest.h:1910
IntWrapper::operator+
IntWrapper operator+(int other) const
Definition: googletest-param-test-test.cc:260
SeparateInstanceTest::global_count_
static int global_count_
Definition: googletest-param-test-test.cc:762
CustomIntegerNamingTest
Definition: googletest-param-test-test.cc:886
SeparateInstanceTest::TearDownTestSuite
static void TearDownTestSuite()
Definition: googletest-param-test-test.cc:752
MacroNamingTestNonParametrized
Definition: googletest-param-test-test.cc:811
NonParameterizedBaseTest::n_
int n_
Definition: googletest-param-test-test.cc:987
Unstreamable::value_
int value_
Definition: googletest-param-test-test.cc:964
values
GLenum GLsizei GLsizei GLint * values
Definition: glcorearb.h:3591
testing::Bool
internal::ParamGenerator< bool > Bool()
Definition: gtest-param-test.h:364
StatefulNamingFunctor::sum
int sum
Definition: googletest-param-test-test.cc:934
DogAdder::value_
std::string value_
Definition: googletest-param-test-test.cc:233
ParameterizedDerivedTest::global_count_
static int global_count_
Definition: googletest-param-test-test.cc:995
NonDefaultConstructAssignString::str_
std::string str_
Definition: googletest-param-test-test.cc:496
test_generation_params
const int test_generation_params[]
Definition: googletest-param-test-test.cc:607
ParameterizedDeathTest
Definition: googletest-param-test-test.cc:1010
EXPECT_STREQ
#define EXPECT_STREQ(val1, val2)
Definition: glog/src/googletest.h:184
TestGenerationTest::PARAMETER_COUNT
@ PARAMETER_COUNT
Definition: googletest-param-test-test.cc:612
testing::Environment
Definition: gtest.h:1039
n_
int n_
Definition: gmock-matchers_test.cc:4127
MyEnums
MyEnums
Definition: googletest-param-test-test.cc:1021
EXPECT_DEATH_IF_SUPPORTED
#define EXPECT_DEATH_IF_SUPPORTED(statement, regex)
Definition: gtest-death-test.h:335
TestGenerationTest::current_parameter_
int current_parameter_
Definition: googletest-param-test-test.cc:665
TestGenerationTest::SetUp
void SetUp() override
Definition: googletest-param-test-test.cc:622
RUN_ALL_TESTS
int RUN_ALL_TESTS() GTEST_MUST_USE_RESULT_
Definition: gtest.h:2502
NonDefaultConstructAssignString::NonDefaultConstructAssignString
NonDefaultConstructAssignString()
TEST_F
TEST_F(PREFIX_WITH_MACRO(NamingTestNonParametrized), PREFIX_WITH_FOO(SomeTestName))
Definition: googletest-param-test-test.cc:813
TestGenerationTest::TestGenerationTest
TestGenerationTest()
Definition: googletest-param-test-test.cc:618
EXPECT_TRUE
#define EXPECT_TRUE(cond)
Definition: glog/src/googletest.h:137
CommentTest
Definition: googletest-param-test-test.cc:967
extern_gen
ParamGenerator< int > extern_gen
Definition: googletest-param-test2-test.cc:43
TestGenerationTest::TearDownTestSuite
static void TearDownTestSuite()
Definition: googletest-param-test-test.cc:652
GeneratorEvaluationTest::param_value_
static int param_value_
Definition: googletest-param-test-test.cc:697
TestGenerationTest::collected_parameters_
static vector< int > collected_parameters_
Definition: googletest-param-test-test.cc:666
NonDefaultConstructAssignString::NonDefaultConstructAssignString
NonDefaultConstructAssignString(const std::string &s)
Definition: googletest-param-test-test.cc:491
GeneratorEvaluationTest::param_value
static int param_value()
Definition: googletest-param-test-test.cc:693
i
int i
Definition: gmock-matchers_test.cc:764
GeneratorEvaluationTest
Definition: googletest-param-test-test.cc:691
TestGenerationEnvironment
Definition: googletest-param-test-test.cc:553
Unstreamable
Definition: googletest-param-test-test.cc:959
MacroNamingTest
Definition: googletest-param-test-test.cc:795
NonDefaultConstructAssignString::operator=
void operator=(const NonDefaultConstructAssignString &)
StatefulNamingFunctor
Definition: googletest-param-test-test.cc:927
GeneratorEvaluationTest::set_param_value
static void set_param_value(int param_value)
Definition: googletest-param-test-test.cc:694
TestGenerationEnvironment::set_up_count_
int set_up_count_
Definition: googletest-param-test-test.cc:600
testing::UnitTest::GetTestSuite
const TestSuite * GetTestSuite(int i) const
Definition: gtest.cc:4643
PREFIX_WITH_MACRO
#define PREFIX_WITH_MACRO(test_name)
Definition: googletest-param-test-test.cc:798
PrintValue
::std::string PrintValue(const T &value)
Definition: googletest-param-test-test.cc:69
TEST_P
TEST_P(TestGenerationTest, TestsExpandedAndRun)
Definition: googletest-param-test-test.cc:673
DogAdder::value
const std::string & value() const
Definition: googletest-param-test-test.cc:230
testing::UnitTest
Definition: gtest.h:1251
inf
const char inf[]
Definition: php/ext/google/protobuf/upb.c:12404
CustomStructNamingTest
Definition: googletest-param-test-test.cc:911
testing::PrintToStringParamName
Definition: gtest-param-util.h:65
PREFIX_WITH_FOO
#define PREFIX_WITH_FOO(test_name)
Definition: googletest-param-test-test.cc:797
EXPECT_FALSE
#define EXPECT_FALSE(cond)
Definition: glog/src/googletest.h:145
CustomStruct::CustomStruct
CustomStruct(int value)
Definition: googletest-param-test-test.cc:902
IntWrapper::value_
int value_
Definition: googletest-param-test-test.cc:267
testing::WithParamInterface< int >::GetParam
static const ParamType & GetParam()
Definition: gtest.h:1882
testing::UnitTest::GetInstance
static UnitTest * GetInstance()
Definition: gtest.cc:4538
CustomFunctorNamingTest
Definition: googletest-param-test-test.cc:826
google::protobuf::python::descriptor::Values
static PyObject * Values(PyContainer *self, PyObject *args)
Definition: descriptor_containers.cc:489
DogAdder::DogAdder
DogAdder(const DogAdder &other)
Definition: googletest-param-test-test.cc:215
ExternalGeneratorTest
Definition: googletest-param-test-test.cc:710
StatefulNamingTest
Definition: googletest-param-test-test.cc:937
StatefulNamingFunctor::StatefulNamingFunctor
StatefulNamingFunctor()
Definition: googletest-param-test-test.cc:928
TestGenerationEnvironment::GTEST_DISALLOW_COPY_AND_ASSIGN_
GTEST_DISALLOW_COPY_AND_ASSIGN_(TestGenerationEnvironment)
Unstreamable::Unstreamable
Unstreamable(int value)
Definition: googletest-param-test-test.cc:961
Range
Range(1<< 0, 1<< 10)
VerifyGeneratorIsEmpty
void VerifyGeneratorIsEmpty(const ParamGenerator< T > &generator)
Definition: googletest-param-test-test.cc:119
IntWrapper
Definition: googletest-param-test-test.cc:250
TestGenerationTest
Definition: googletest-param-test-test.cc:609
val
GLuint GLfloat * val
Definition: glcorearb.h:3604
CustomStruct::x
int x
Definition: googletest-param-test-test.cc:903
f
GLfloat f
Definition: glcorearb.h:3964
value
GLsizei const GLfloat * value
Definition: glcorearb.h:3093
TestGenerationEnvironment::fixture_constructor_count_
int fixture_constructor_count_
Definition: googletest-param-test-test.cc:599
ENUM2
@ ENUM2
Definition: googletest-param-test-test.cc:1023
VerifyGenerator
void VerifyGenerator(const ParamGenerator< T > &generator, const T(&expected_values)[N])
Definition: googletest-param-test-test.cc:77
CustomLambdaNamingTest
Definition: googletest-param-test-test.cc:858
MultipleInstantiationTest
Definition: googletest-param-test-test.cc:729
NonParameterizedBaseTest::NonParameterizedBaseTest
NonParameterizedBaseTest()
Definition: googletest-param-test-test.cc:985
testing::AddGlobalTestEnvironment
Environment * AddGlobalTestEnvironment(Environment *env)
Definition: gtest.h:1468
IntWrapper::operator=
IntWrapper operator=(const IntWrapper &other)
Definition: googletest-param-test-test.cc:255
testing::ValuesIn
internal::ParamGenerator< typename ::testing::internal::IteratorTraits< ForwardIterator >::value_type > ValuesIn(ForwardIterator begin, ForwardIterator end)
Definition: gtest-param-test.h:301
CustomStruct
Definition: googletest-param-test-test.cc:901
StatefulNamingTest::StatefulNamingTest
StatefulNamingTest()
Definition: googletest-param-test-test.cc:939
CustomParamNameFunctor
Definition: googletest-param-test-test.cc:829
ENUM1
@ ENUM1
Definition: googletest-param-test-test.cc:1022
TestGenerationTest::SetUpTestSuite
static void SetUpTestSuite()
Definition: googletest-param-test-test.cc:631
testing::Values
internal::ValueArray< T... > Values(T... v)
Definition: gtest-param-test.h:340
it
MapIter it
Definition: php/ext/google/protobuf/map.c:205
NonParameterizedBaseTest
Definition: googletest-param-test-test.cc:983
CustomParamNameFunction
std::string CustomParamNameFunction(const ::testing::TestParamInfo< std::string > &inf)
Definition: googletest-param-test-test.cc:844
ParameterizedDerivedTest::count_
int count_
Definition: googletest-param-test-test.cc:994
TestGenerationEnvironment::TestBodyExecuted
void TestBodyExecuted()
Definition: googletest-param-test-test.cc:563
setup.test_suite
test_suite
Definition: compatibility_tests/v2.5.0/setup.py:82
TEST
TEST(IteratorTest, ParamIteratorConformsToForwardIteratorConcept)
Definition: googletest-param-test-test.cc:136
array
PHP_PROTO_OBJECT_FREE_END PHP_PROTO_OBJECT_DTOR_END intern array
Definition: array.c:111
testing::PrintToString
::std::string PrintToString(const T &value)
Definition: gtest-printers.h:938


libaditof
Author(s):
autogenerated on Wed May 21 2025 02:06:52