mimic++
v10.0.1
Toggle main menu visibility
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
#if __has_include("mimic++/Reporting.hpp")
12
#include "
mimic++/Reporting.hpp
"
13
#include "
mimic++/utilities/C++23Backports.hpp
"
14
#elif not defined(MIMICPP_VERSION)
15
#error "It appears that the test-adapter is not included in the mimic++ project or package." \
16
"If you plan to use it alongside the mimic++-amalgamated header, please ensure to include the adapter-header afterwards."
17
#endif
18
19
#if __has_include(<boost/test/unit_test.hpp>)
20
#include <boost/test/unit_test.hpp>
21
#else
22
#error "Unable to find Boost.Test includes."
23
#endif
24
25
namespace
mimicpp::reporting::detail::boost_test
26
{
27
struct
failure
28
{
29
};
30
31
[[noreturn]]
32
inline
void
send_fail(
StringViewT
const
msg)
33
{
34
BOOST_TEST_FAIL(msg);
35
util::unreachable
();
36
}
37
38
inline
void
send_success(
StringViewT
const
msg)
39
{
40
BOOST_TEST_MESSAGE(msg);
41
}
42
43
inline
void
send_warning(
StringViewT
const
msg)
44
{
45
BOOST_TEST_MESSAGE(
"warning: "
) << msg.data();
46
}
47
}
48
49
namespace
mimicpp::reporting
50
{
51
// GCOVR_EXCL_START
52
61
using
BoostTestReporterT
=
BasicReporter
<
62
&detail::boost_test::send_success,
63
&detail::boost_test::send_warning,
64
&detail::boost_test::send_fail>;
65
66
// GCOVR_EXCL_STOP
67
}
68
69
namespace
mimicpp::reporting::detail::boost_test
70
{
71
[[maybe_unused]]
72
inline
ReporterInstaller<BoostTestReporterT>
const
installer{};
73
}
74
75
#endif
Reporting.hpp
mimicpp::reporting::BasicReporter
A reporter, which creates text messages and reports them via the provided callbacks.
Definition
BasicReporter.hpp:39
mimicpp::reporting::BoostTestReporterT
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:61
mimicpp::reporting
Definition
BasicReporter.hpp:26
mimicpp::util::unreachable
void unreachable()
Invokes undefined behavior.
Definition
C++23Backports.hpp:40
mimicpp::StringViewT
std::basic_string_view< CharT, CharTraitsT > StringViewT
Definition
Fwd.hpp:398
C++23Backports.hpp
mimic++_ext
adapters
BoostTest.hpp
Generated on
for mimic++ by
1.18.0