Elements  6.2
A C++ base framework for the Euclid Software.
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 <boost/test/unit_test.hpp>
30 #include <boost/version.hpp> // for the BOOST_VERSION define
31 #include <gmock/gmock.h>
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 
45 
46 public:
48  testing::InitGoogleMock(&boost::unit_test::framework::master_test_suite().argc,
49  boost::unit_test::framework::master_test_suite().argv);
50  auto& listeners = testing::UnitTest::GetInstance()->listeners();
51  delete listeners.Release(listeners.default_result_printer());
52  listeners.Append(new BoostTestAdapter);
53  }
54 };
55 
56 #if BOOST_VERSION >= 105900
57 BOOST_GLOBAL_FIXTURE(GoogleMockSetupFixture);
58 #else
59 BOOST_GLOBAL_FIXTURE(GoogleMockSetupFixture)
60 #endif
61 
62 #endif // ELEMENTSKERNEL_ELEMENTSKERNEL_ENABLEGMOCK_H_
63 
Export.h
defines the macros to be used for explicit export of the symbols
BoostTestAdapter
Definition: EnableGMock.h:35
GoogleMockSetupFixture
Definition: EnableGMock.h:44
BoostTestAdapter::OnTestPartResult
void OnTestPartResult(const testing::TestPartResult &testPartResult) override
Definition: EnableGMock.h:37
GoogleMockSetupFixture::GoogleMockSetupFixture
GoogleMockSetupFixture()
Definition: EnableGMock.h:47