Googletest export
Change remaining samples to use new Test Suite API PiperOrigin-RevId: 229231566
This commit is contained in:
		@@ -92,7 +92,7 @@ using testing::Types;
 | 
				
			|||||||
// The list of types we want to test.
 | 
					// The list of types we want to test.
 | 
				
			||||||
typedef Types<OnTheFlyPrimeTable, PreCalculatedPrimeTable> Implementations;
 | 
					typedef Types<OnTheFlyPrimeTable, PreCalculatedPrimeTable> Implementations;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
TYPED_TEST_CASE(PrimeTableTest, Implementations);
 | 
					TYPED_TEST_SUITE(PrimeTableTest, Implementations);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Then use TYPED_TEST(TestCaseName, TestName) to define a typed test,
 | 
					// Then use TYPED_TEST(TestCaseName, TestName) to define a typed test,
 | 
				
			||||||
// similar to TEST_F.
 | 
					// similar to TEST_F.
 | 
				
			||||||
@@ -163,7 +163,7 @@ class PrimeTableTest2 : public PrimeTableTest<T> {
 | 
				
			|||||||
// Then, declare the test case.  The argument is the name of the test
 | 
					// Then, declare the test case.  The argument is the name of the test
 | 
				
			||||||
// fixture, and also the name of the test case (as usual).  The _P
 | 
					// fixture, and also the name of the test case (as usual).  The _P
 | 
				
			||||||
// suffix is for "parameterized" or "pattern".
 | 
					// suffix is for "parameterized" or "pattern".
 | 
				
			||||||
TYPED_TEST_CASE_P(PrimeTableTest2);
 | 
					TYPED_TEST_SUITE_P(PrimeTableTest2);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Next, use TYPED_TEST_P(TestCaseName, TestName) to define a test,
 | 
					// Next, use TYPED_TEST_P(TestCaseName, TestName) to define a test,
 | 
				
			||||||
// similar to what you do with TEST_F.
 | 
					// similar to what you do with TEST_F.
 | 
				
			||||||
@@ -196,7 +196,7 @@ TYPED_TEST_P(PrimeTableTest2, CanGetNextPrime) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
// Type-parameterized tests involve one extra step: you have to
 | 
					// Type-parameterized tests involve one extra step: you have to
 | 
				
			||||||
// enumerate the tests you defined:
 | 
					// enumerate the tests you defined:
 | 
				
			||||||
REGISTER_TYPED_TEST_CASE_P(
 | 
					REGISTER_TYPED_TEST_SUITE_P(
 | 
				
			||||||
    PrimeTableTest2,  // The first argument is the test case name.
 | 
					    PrimeTableTest2,  // The first argument is the test case name.
 | 
				
			||||||
    // The rest of the arguments are the test names.
 | 
					    // The rest of the arguments are the test names.
 | 
				
			||||||
    ReturnsFalseForNonPrimes, ReturnsTrueForPrimes, CanGetNextPrime);
 | 
					    ReturnsFalseForNonPrimes, ReturnsTrueForPrimes, CanGetNextPrime);
 | 
				
			||||||
@@ -216,9 +216,9 @@ REGISTER_TYPED_TEST_CASE_P(
 | 
				
			|||||||
// defined at the time we write the TYPED_TEST_P()s.
 | 
					// defined at the time we write the TYPED_TEST_P()s.
 | 
				
			||||||
typedef Types<OnTheFlyPrimeTable, PreCalculatedPrimeTable>
 | 
					typedef Types<OnTheFlyPrimeTable, PreCalculatedPrimeTable>
 | 
				
			||||||
    PrimeTableImplementations;
 | 
					    PrimeTableImplementations;
 | 
				
			||||||
INSTANTIATE_TYPED_TEST_CASE_P(OnTheFlyAndPreCalculated,    // Instance name
 | 
					INSTANTIATE_TYPED_TEST_SUITE_P(OnTheFlyAndPreCalculated,    // Instance name
 | 
				
			||||||
                              PrimeTableTest2,             // Test case name
 | 
					                               PrimeTableTest2,             // Test case name
 | 
				
			||||||
                              PrimeTableImplementations);  // Type list
 | 
					                               PrimeTableImplementations);  // Type list
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#endif  // GTEST_HAS_TYPED_TEST_P
 | 
					#endif  // GTEST_HAS_TYPED_TEST_P
 | 
				
			||||||
}  // namespace
 | 
					}  // namespace
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -110,8 +110,8 @@ TEST_P(PrimeTableTestSmpl7, CanGetNextPrime) {
 | 
				
			|||||||
//
 | 
					//
 | 
				
			||||||
// Here, we instantiate our tests with a list of two PrimeTable object
 | 
					// Here, we instantiate our tests with a list of two PrimeTable object
 | 
				
			||||||
// factory functions:
 | 
					// factory functions:
 | 
				
			||||||
INSTANTIATE_TEST_CASE_P(OnTheFlyAndPreCalculated, PrimeTableTestSmpl7,
 | 
					INSTANTIATE_TEST_SUITE_P(OnTheFlyAndPreCalculated, PrimeTableTestSmpl7,
 | 
				
			||||||
                        Values(&CreateOnTheFlyPrimeTable,
 | 
					                         Values(&CreateOnTheFlyPrimeTable,
 | 
				
			||||||
                               &CreatePreCalculatedPrimeTable<1000>));
 | 
					                                &CreatePreCalculatedPrimeTable<1000>));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
}  // namespace
 | 
					}  // namespace
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -148,8 +148,7 @@ TEST_P(PrimeTableTest, CanGetNextPrime) {
 | 
				
			|||||||
// will put some of the tested numbers beyond the capability of the
 | 
					// will put some of the tested numbers beyond the capability of the
 | 
				
			||||||
// PrecalcPrimeTable instance and some inside it (10). Combine will produce all
 | 
					// PrecalcPrimeTable instance and some inside it (10). Combine will produce all
 | 
				
			||||||
// possible combinations.
 | 
					// possible combinations.
 | 
				
			||||||
INSTANTIATE_TEST_CASE_P(MeaningfulTestParameters,
 | 
					INSTANTIATE_TEST_SUITE_P(MeaningfulTestParameters, PrimeTableTest,
 | 
				
			||||||
                        PrimeTableTest,
 | 
					                         Combine(Bool(), Values(1, 10)));
 | 
				
			||||||
                        Combine(Bool(), Values(1, 10)));
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
}  // namespace
 | 
					}  // namespace
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user