| 1 |
/* |
| 2 |
* Trompeloeil C++ mocking framework |
| 3 |
* |
| 4 |
* Copyright Björn Fahller 2014-2019 |
| 5 |
* Copyright Tore Martin Hagen 2019 |
| 6 |
* |
| 7 |
* Use, modification and distribution is subject to the |
| 8 |
* Boost Software License, Version 1.0. (See accompanying |
| 9 |
* file LICENSE_1_0.txt or copy at |
| 10 |
* http://www.boost.org/LICENSE_1_0.txt) |
| 11 |
* |
| 12 |
* Project home: https://github.com/rollbear/trompeloeil |
| 13 |
*/ |
| 14 |
|
| 15 |
|
| 16 |
#ifndef TROMPELOEIL_CATCH2_HPP_ |
| 17 |
#define TROMPELOEIL_CATCH2_HPP_ |
| 18 |
|
| 19 |
#ifndef CATCH_VERSION_MAJOR |
| 20 |
#error "<catch.hpp> must be included before <catch2/trompeloeil.hpp>" |
| 21 |
#endif |
| 22 |
|
| 23 |
#include "../trompeloeil.hpp" |
| 24 |
|
| 25 |
namespace trompeloeil |
| 26 |
{ |
| 27 |
template <> |
| 28 |
inline void reporter<specialized>::send( |
| 29 |
severity s, |
| 30 |
const char* file, |
| 31 |
unsigned long line, |
| 32 |
const char* msg) |
| 33 |
{ |
| 34 |
std::ostringstream os; |
| 35 |
if (line) os << file << ':' << line << '\n'; |
| 36 |
os << msg; |
| 37 |
auto failure = os.str(); |
| 38 |
if (s == severity::fatal) |
| 39 |
{ |
| 40 |
FAIL(failure); |
| 41 |
} |
| 42 |
else |
| 43 |
{ |
| 44 |
CAPTURE(failure); |
| 45 |
CHECK(failure.empty()); |
| 46 |
} |
| 47 |
} |
| 48 |
|
| 49 |
template <> |
| 50 |
inline void reporter<specialized>::sendOk( |
| 51 |
const char* trompeloeil_mock_calls_done_correctly) |
| 52 |
{ |
| 53 |
REQUIRE(trompeloeil_mock_calls_done_correctly != 0); |
| 54 |
} |
| 55 |
} |
| 56 |
|
| 57 |
|
| 58 |
#endif //TROMPELOEIL_CATCH2_HPP_ |