Elements 6.1.2
A C++ base framework for the Euclid Software.
Loading...
Searching...
No Matches
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
35class 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
46public:
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
57BOOST_GLOBAL_FIXTURE(GoogleMockSetupFixture);
58#else
59BOOST_GLOBAL_FIXTURE(GoogleMockSetupFixture)
60#endif
61
62#endif // ELEMENTSKERNEL_ELEMENTSKERNEL_ENABLEGMOCK_H_
63
defines the macros to be used for explicit export of the symbols
void OnTestPartResult(const testing::TestPartResult &testPartResult) override
Definition: EnableGMock.h:37