PageRenderTime 31ms CodeModel.GetById 25ms RepoModel.GetById 0ms app.codeStats 0ms

/thirdparty/breakpad/third_party/protobuf/protobuf/gtest/test/gtest_filter_unittest_.cc

http://github.com/tomahawk-player/tomahawk
C++ | 140 lines | 61 code | 33 blank | 46 comment | 0 complexity | 3897b602993eaa1bfffdd40bd48215ba MD5 | raw file
Possible License(s): LGPL-2.1, BSD-3-Clause, GPL-3.0, GPL-2.0
  1. // Copyright 2005, 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. // Author: wan@google.com (Zhanyong Wan)
  31. // Unit test for Google Test test filters.
  32. //
  33. // A user can specify which test(s) in a Google Test program to run via
  34. // either the GTEST_FILTER environment variable or the --gtest_filter
  35. // flag. This is used for testing such functionality.
  36. //
  37. // The program will be invoked from a Python unit test. Don't run it
  38. // directly.
  39. #include <gtest/gtest.h>
  40. namespace {
  41. // Test case FooTest.
  42. class FooTest : public testing::Test {
  43. };
  44. TEST_F(FooTest, Abc) {
  45. }
  46. TEST_F(FooTest, Xyz) {
  47. FAIL() << "Expected failure.";
  48. }
  49. // Test case BarTest.
  50. TEST(BarTest, TestOne) {
  51. }
  52. TEST(BarTest, TestTwo) {
  53. }
  54. TEST(BarTest, TestThree) {
  55. }
  56. TEST(BarTest, DISABLED_TestFour) {
  57. FAIL() << "Expected failure.";
  58. }
  59. TEST(BarTest, DISABLED_TestFive) {
  60. FAIL() << "Expected failure.";
  61. }
  62. // Test case BazTest.
  63. TEST(BazTest, TestOne) {
  64. FAIL() << "Expected failure.";
  65. }
  66. TEST(BazTest, TestA) {
  67. }
  68. TEST(BazTest, TestB) {
  69. }
  70. TEST(BazTest, DISABLED_TestC) {
  71. FAIL() << "Expected failure.";
  72. }
  73. // Test case HasDeathTest
  74. TEST(HasDeathTest, Test1) {
  75. EXPECT_DEATH_IF_SUPPORTED(exit(1), ".*");
  76. }
  77. // We need at least two death tests to make sure that the all death tests
  78. // aren't on the first shard.
  79. TEST(HasDeathTest, Test2) {
  80. EXPECT_DEATH_IF_SUPPORTED(exit(1), ".*");
  81. }
  82. // Test case FoobarTest
  83. TEST(DISABLED_FoobarTest, Test1) {
  84. FAIL() << "Expected failure.";
  85. }
  86. TEST(DISABLED_FoobarTest, DISABLED_Test2) {
  87. FAIL() << "Expected failure.";
  88. }
  89. // Test case FoobarbazTest
  90. TEST(DISABLED_FoobarbazTest, TestA) {
  91. FAIL() << "Expected failure.";
  92. }
  93. #if GTEST_HAS_PARAM_TEST
  94. class ParamTest : public testing::TestWithParam<int> {
  95. };
  96. TEST_P(ParamTest, TestX) {
  97. }
  98. TEST_P(ParamTest, TestY) {
  99. }
  100. INSTANTIATE_TEST_CASE_P(SeqP, ParamTest, testing::Values(1, 2));
  101. INSTANTIATE_TEST_CASE_P(SeqQ, ParamTest, testing::Values(5, 6));
  102. #endif // GTEST_HAS_PARAM_TEST
  103. } // namespace
  104. int main(int argc, char **argv) {
  105. ::testing::InitGoogleTest(&argc, argv);
  106. return RUN_ALL_TESTS();
  107. }