Elements  5.8
A C++ base framework for the Euclid Software.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
EnableGMock.h
Go to the documentation of this file.
1 
26 #ifndef ELEMENTSKERNEL_ELEMENTSKERNEL_ENABLEGMOCK_H_
27 #define ELEMENTSKERNEL_ELEMENTSKERNEL_ENABLEGMOCK_H_
28 
29 #include <gmock/gmock.h>
30 #include <boost/test/unit_test.hpp>
31 #include <boost/version.hpp> // for the BOOST_VERSION define
32 
33 #include "ElementsKernel/Export.h" // ELEMENTS_API
34 
35 class BoostTestAdapter: public testing::EmptyTestEventListener {
36 
37  void OnTestPartResult(const testing::TestPartResult& testPartResult) override {
38  if (testPartResult.failed()) {
39  BOOST_ERROR(testPartResult.summary());
40  }
41  }
42 
43 };
44 
46 
47 public:
48 
50  testing::InitGoogleMock(
51  &boost::unit_test::framework::master_test_suite().argc,
52  boost::unit_test::framework::master_test_suite().argv);
53  auto& listeners = testing::UnitTest::GetInstance()->listeners();
54  delete listeners.Release(listeners.default_result_printer());
55  listeners.Append(new BoostTestAdapter);
56  }
57 
58 };
59 
60 #if BOOST_VERSION >= 105900
61 BOOST_GLOBAL_FIXTURE(GoogleMockSetupFixture);
62 #else
63 BOOST_GLOBAL_FIXTURE(GoogleMockSetupFixture)
64 #endif
65 
66 #endif // ELEMENTSKERNEL_ELEMENTSKERNEL_ENABLEGMOCK_H_
67 
defines the macros to be used for explicit export of the symbols
void OnTestPartResult(const testing::TestPartResult &testPartResult) override
Definition: EnableGMock.h:37