88 #if GTEST_HAS_TYPED_TEST
95 typedef Types<char, int> TwoTypes;
108 typename TestFixture::IntSet empty2;
125 EXPECT_EQ(static_cast<TypeParam>(2), this->value_);
131 template <
typename T>
132 class TypedTest1 :
public Test {
140 template <
typename T>
141 class TypedTest2 :
public Test {
156 template <
typename T>
157 class NumericTest :
public Test {
160 typedef Types<int, long> NumericTypes;
169 #endif // GTEST_HAS_TYPED_TEST
172 #if GTEST_HAS_TYPED_TEST_P
174 using testing::Types;
175 using testing::internal::TypedTestCasePState;
179 class TypedTestCasePStateTest :
public Test {
181 virtual void SetUp() {
182 state_.AddTestName(
"foo.cc", 0,
"FooTest",
"A");
183 state_.AddTestName(
"foo.cc", 0,
"FooTest",
"B");
184 state_.AddTestName(
"foo.cc", 0,
"FooTest",
"C");
187 TypedTestCasePState state_;
190 TEST_F(TypedTestCasePStateTest, SucceedsForMatchingList) {
191 const char* tests =
"A, B, C";
193 state_.VerifyRegisteredTestNames(
"foo.cc", 1, tests));
198 TEST_F(TypedTestCasePStateTest, IgnoresOrderAndSpaces) {
199 const char* tests =
"A,C, B";
201 state_.VerifyRegisteredTestNames(
"foo.cc", 1, tests));
204 typedef TypedTestCasePStateTest TypedTestCasePStateDeathTest;
206 TEST_F(TypedTestCasePStateDeathTest, DetectsDuplicates) {
208 state_.VerifyRegisteredTestNames(
"foo.cc", 1,
"A, B, A, C"),
209 "foo\\.cc.1.?: Test A is listed more than once\\.");
212 TEST_F(TypedTestCasePStateDeathTest, DetectsExtraTest) {
214 state_.VerifyRegisteredTestNames(
"foo.cc", 1,
"A, B, C, D"),
215 "foo\\.cc.1.?: No test named D can be found in this test case\\.");
218 TEST_F(TypedTestCasePStateDeathTest, DetectsMissedTest) {
220 state_.VerifyRegisteredTestNames(
"foo.cc", 1,
"A, C"),
221 "foo\\.cc.1.?: You forgot to list test B\\.");
226 TEST_F(TypedTestCasePStateDeathTest, DetectsTestAfterRegistration) {
227 state_.VerifyRegisteredTestNames(
"foo.cc", 1,
"A, B, C");
229 state_.AddTestName(
"foo.cc", 2,
"FooTest",
"D"),
230 "foo\\.cc.2.?: Test D must be defined before REGISTER_TYPED_TEST_CASE_P"
231 "\\(FooTest, \\.\\.\\.\\)\\.");
237 template <
typename T>
264 ValuesAreCorrect, ValuesAreStillCorrect);
266 typedef Types<short, long> MyTwoTypes;
272 template <
typename T>
273 class TypedTestP1 :
public Test {
280 typedef int IntAfterTypedTestCaseP;
287 typedef int IntBeforeRegisterTypedTestCaseP;
291 template <
typename T>
292 class TypedTestP2 :
public Test {
305 IntAfterTypedTestCaseP after = 0;
306 IntBeforeRegisterTypedTestCaseP before = 0;
320 typedef Types<std::vector<double>, std::set<char> > MyContainers;
328 template <
typename T>
329 class NumericTest :
public Test {
343 DefaultIsZero, ZeroIsLessThanOne);
344 typedef Types<int, double> NumericTypes;
347 static const char* GetTestName() {
351 template <
typename T>
class TrimmedTest :
public Test { };
360 Test1, Test2,Test3 , Test4 ,Test5 );
361 template <
typename T1,
typename T2>
struct MyPair {};
363 typedef Types<int, double, MyPair<int, int> > TrimTypes;
368 #endif // GTEST_HAS_TYPED_TEST_P
370 #if !defined(GTEST_HAS_TYPED_TEST) && !defined(GTEST_HAS_TYPED_TEST_P)
378 TEST(DummyTest, TypedTestsAreNotSupportedOnThisPlatform) {}
380 #endif // #if !defined(GTEST_HAS_TYPED_TEST) && !defined(GTEST_HAS_TYPED_TEST_P)