diff options
author | shiqian <shiqian@861a406c-534a-0410-8894-cb66d6ee9925> | 2008-09-08 17:55:52 +0000 |
---|---|---|
committer | shiqian <shiqian@861a406c-534a-0410-8894-cb66d6ee9925> | 2008-09-08 17:55:52 +0000 |
commit | a2b1a8556ea64014606d78b09333d9c522430a25 (patch) | |
tree | a4f4a88d89b4f957655a479bba3f33908572fcb5 /test/gtest_nc.cc | |
parent | 0c5a66245b8c5939b36b2aad6f4d5ab89b724b1a (diff) | |
download | googletest-a2b1a8556ea64014606d78b09333d9c522430a25.tar.gz googletest-a2b1a8556ea64014606d78b09333d9c522430a25.tar.bz2 googletest-a2b1a8556ea64014606d78b09333d9c522430a25.zip |
Adds support for type-parameterized tests (by Zhanyong Wan); also adds case-insensitive wide string comparison to the String class (by Vlad Losev).
Diffstat (limited to 'test/gtest_nc.cc')
-rw-r--r-- | test/gtest_nc.cc | 78 |
1 files changed, 78 insertions, 0 deletions
diff --git a/test/gtest_nc.cc b/test/gtest_nc.cc index 001deb1b..5cbaeefa 100644 --- a/test/gtest_nc.cc +++ b/test/gtest_nc.cc @@ -103,6 +103,84 @@ class MyEnvironment : public testing::Environment { } }; +#elif defined(TEST_CATCHES_WRONG_CASE_IN_TYPED_TEST_P) +// Tests that the compiler catches using the wrong test case name in +// TYPED_TEST_P. + +#include <gtest/gtest.h> + +template <typename T> +class FooTest : public testing::Test { +}; + +template <typename T> +class BarTest : public testing::Test { +}; + +TYPED_TEST_CASE_P(FooTest); +TYPED_TEST_P(BarTest, A) {} // Wrong test case name. +REGISTER_TYPED_TEST_CASE_P(FooTest, A); +INSTANTIATE_TYPED_TEST_CASE_P(My, FooTest, testing::Types<int>); + +#elif defined(TEST_CATCHES_WRONG_CASE_IN_REGISTER_TYPED_TEST_CASE_P) +// Tests that the compiler catches using the wrong test case name in +// REGISTER_TYPED_TEST_CASE_P. + +#include <gtest/gtest.h> + +template <typename T> +class FooTest : public testing::Test { +}; + +template <typename T> +class BarTest : public testing::Test { +}; + +TYPED_TEST_CASE_P(FooTest); +TYPED_TEST_P(FooTest, A) {} +REGISTER_TYPED_TEST_CASE_P(BarTest, A); // Wrong test case name. +INSTANTIATE_TYPED_TEST_CASE_P(My, FooTest, testing::Types<int>); + +#elif defined(TEST_CATCHES_WRONG_CASE_IN_INSTANTIATE_TYPED_TEST_CASE_P) +// Tests that the compiler catches using the wrong test case name in +// INSTANTIATE_TYPED_TEST_CASE_P. + +#include <gtest/gtest.h> + +template <typename T> +class FooTest : public testing::Test { +}; + +template <typename T> +class BarTest : public testing::Test { +}; + +TYPED_TEST_CASE_P(FooTest); +TYPED_TEST_P(FooTest, A) {} +REGISTER_TYPED_TEST_CASE_P(FooTest, A); + +// Wrong test case name. +INSTANTIATE_TYPED_TEST_CASE_P(My, BarTest, testing::Types<int>); + +#elif defined(TEST_CATCHES_INSTANTIATE_TYPED_TESET_CASE_P_WITH_SAME_NAME_PREFIX) +// Tests that the compiler catches instantiating TYPED_TEST_CASE_P +// twice with the same name prefix. + +#include <gtest/gtest.h> + +template <typename T> +class FooTest : public testing::Test { +}; + +TYPED_TEST_CASE_P(FooTest); +TYPED_TEST_P(FooTest, A) {} +REGISTER_TYPED_TEST_CASE_P(FooTest, A); + +INSTANTIATE_TYPED_TEST_CASE_P(My, FooTest, testing::Types<int>); + +// Wrong name prefix: "My" has been used. +INSTANTIATE_TYPED_TEST_CASE_P(My, FooTest, testing::Types<double>); + #else // A sanity test. This should compile. |