mimic++ v2
Loading...
Searching...
No Matches
BoostTest.hpp
Go to the documentation of this file.
1// // Copyright Dominic (DNKpp) Koepke 2024 - 2024.
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{
57 &detail::boost_test::send_success,
58 &detail::boost_test::send_warning,
59 &detail::boost_test::send_fail
60 >;
61}
62
63namespace mimicpp::detail::boost_test
64{
65 inline const ReporterInstaller<BoostTestReporterT> installer{};
66}
67
68#endif
A reporter, which creates text messages and reports them via the provided callbacks.
Definition Reporter.hpp:206
Definition BoostTest.hpp:20
void unreachable()
Invokes undefined behavior.
Definition Utility.hpp:93
std::basic_string_view< CharT, CharTraitsT > StringViewT
Definition Printer.hpp:40