mimic++ v6
Loading...
Searching...
No Matches
BoostTest.hpp
Go to the documentation of this file.
1// Copyright Dominic (DNKpp) Koepke 2024 - 2025.
2// Distributed under the Boost Software License, Version 1.0.
3// (See accompanying file LICENSE_1_0.txt or copy at
4// https://www.boost.org/LICENSE_1_0.txt)
5
6#ifndef MIMICPP_ADAPTERS_BOOST_TEST_HPP
7#define MIMICPP_ADAPTERS_BOOST_TEST_HPP
8
9#pragma once
10
11#include "mimic++/Reporter.hpp"
12
13#if __has_include(<boost/test/unit_test.hpp>)
14 #include <boost/test/unit_test.hpp>
15#else
16 #error "Unable to find Boost.Test includes."
17#endif
18
19namespace mimicpp::detail::boost_test
20{
21 struct failure
22 {
23 };
24
25 [[noreturn]]
26 inline void send_fail(const StringViewT msg)
27 {
28 BOOST_TEST_FAIL(msg);
30 }
31
32 inline void send_success(const StringViewT msg)
33 {
34 BOOST_TEST_MESSAGE(msg);
35 }
36
37 inline void send_warning(const StringViewT msg)
38 {
39 BOOST_TEST_MESSAGE(
40 format::format(
41 "warning: {}",
42 msg));
43 }
44}
45
46namespace mimicpp
47{
48 // GCOVR_EXCL_START
49
59 &detail::boost_test::send_success,
60 &detail::boost_test::send_warning,
61 &detail::boost_test::send_fail>;
62
63 // GCOVR_EXCL_STOP
64}
65
66namespace mimicpp::detail::boost_test
67{
68 [[maybe_unused]]
69 inline const ReporterInstaller<BoostTestReporterT> installer{};
70}
71
72#endif
A reporter, which creates text messages and reports them via the provided callbacks.
Definition Reporter.hpp:356
BasicReporter< &detail::boost_test::send_success, &detail::boost_test::send_warning, &detail::boost_test::send_fail > BoostTestReporterT
Reporter for the integration into Boost.Test.
Definition BoostTest.hpp:58
Definition BoostTest.hpp:20
void unreachable()
Invokes undefined behavior.
Definition Utility.hpp:91
std::basic_string_view< CharT, CharTraitsT > StringViewT
Definition Fwd.hpp:345