Elements 6.3.1
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> // IWYU pragma: export
32#include <gtest/gtest.h> // IWYU pragma: export
33
34#include "ElementsKernel/Export.h" // ELEMENTS_API
35
36class BoostTestAdapter : public testing::EmptyTestEventListener {
37
38 void OnTestPartResult(const testing::TestPartResult& testPartResult) override {
39 if (testPartResult.failed()) {
40 BOOST_ERROR(testPartResult.summary());
41 }
42 }
43};
44
46
47public:
49 testing::InitGoogleMock(&boost::unit_test::framework::master_test_suite().argc,
50 boost::unit_test::framework::master_test_suite().argv);
51 auto& listeners = testing::UnitTest::GetInstance()->listeners();
52 delete listeners.Release(listeners.default_result_printer());
53 listeners.Append(new BoostTestAdapter);
54 }
55};
56
57#if BOOST_VERSION >= 105900
58BOOST_GLOBAL_FIXTURE(GoogleMockSetupFixture);
59#else
60BOOST_GLOBAL_FIXTURE(GoogleMockSetupFixture)
61#endif
62
63#endif // ELEMENTSKERNEL_ELEMENTSKERNEL_ENABLEGMOCK_H_
64
defines the macros to be used for explicit export of the symbols
void OnTestPartResult(const testing::TestPartResult &testPartResult) override
Definition EnableGMock.h:38