gtest_shuffle_test_.cc
Go to the documentation of this file.
00001 // Copyright 2009, Google Inc.
00002 // All rights reserved.
00003 //
00004 // Redistribution and use in source and binary forms, with or without
00005 // modification, are permitted provided that the following conditions are
00006 // met:
00007 //
00008 //     * Redistributions of source code must retain the above copyright
00009 // notice, this list of conditions and the following disclaimer.
00010 //     * Redistributions in binary form must reproduce the above
00011 // copyright notice, this list of conditions and the following disclaimer
00012 // in the documentation and/or other materials provided with the
00013 // distribution.
00014 //     * Neither the name of Google Inc. nor the names of its
00015 // contributors may be used to endorse or promote products derived from
00016 // this software without specific prior written permission.
00017 //
00018 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
00019 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
00020 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
00021 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
00022 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
00023 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
00024 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
00025 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
00026 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00027 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
00028 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00029 //
00030 // Author: wan@google.com (Zhanyong Wan)
00031 
00032 // Verifies that test shuffling works.
00033 
00034 #include "gtest/gtest.h"
00035 
00036 namespace {
00037 
00038 using ::testing::EmptyTestEventListener;
00039 using ::testing::InitGoogleTest;
00040 using ::testing::Message;
00041 using ::testing::Test;
00042 using ::testing::TestEventListeners;
00043 using ::testing::TestInfo;
00044 using ::testing::UnitTest;
00045 using ::testing::internal::scoped_ptr;
00046 
00047 // The test methods are empty, as the sole purpose of this program is
00048 // to print the test names before/after shuffling.
00049 
00050 class A : public Test {};
00051 TEST_F(A, A) {}
00052 TEST_F(A, B) {}
00053 
00054 TEST(ADeathTest, A) {}
00055 TEST(ADeathTest, B) {}
00056 TEST(ADeathTest, C) {}
00057 
00058 TEST(B, A) {}
00059 TEST(B, B) {}
00060 TEST(B, C) {}
00061 TEST(B, DISABLED_D) {}
00062 TEST(B, DISABLED_E) {}
00063 
00064 TEST(BDeathTest, A) {}
00065 TEST(BDeathTest, B) {}
00066 
00067 TEST(C, A) {}
00068 TEST(C, B) {}
00069 TEST(C, C) {}
00070 TEST(C, DISABLED_D) {}
00071 
00072 TEST(CDeathTest, A) {}
00073 
00074 TEST(DISABLED_D, A) {}
00075 TEST(DISABLED_D, DISABLED_B) {}
00076 
00077 // This printer prints the full test names only, starting each test
00078 // iteration with a "----" marker.
00079 class TestNamePrinter : public EmptyTestEventListener {
00080  public:
00081   virtual void OnTestIterationStart(const UnitTest& /* unit_test */,
00082                                     int /* iteration */) {
00083     printf("----\n");
00084   }
00085 
00086   virtual void OnTestStart(const TestInfo& test_info) {
00087     printf("%s.%s\n", test_info.test_case_name(), test_info.name());
00088   }
00089 };
00090 
00091 }  // namespace
00092 
00093 int main(int argc, char **argv) {
00094   InitGoogleTest(&argc, argv);
00095 
00096   // Replaces the default printer with TestNamePrinter, which prints
00097   // the test name only.
00098   TestEventListeners& listeners = UnitTest::GetInstance()->listeners();
00099   delete listeners.Release(listeners.default_result_printer());
00100   listeners.Append(new TestNamePrinter);
00101 
00102   return RUN_ALL_TESTS();
00103 }


ros_opcua_impl_freeopcua
Author(s): Denis Štogl
autogenerated on Sat Jun 8 2019 18:24:55