mimic++
v10.0.1
Toggle main menu visibility
Loading...
Searching...
No Matches
Doctest.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_DOCTEST_HPP
7
#define MIMICPP_ADAPTERS_DOCTEST_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(<doctest/doctest.h>)
20
#include <doctest/doctest.h>
21
#else
22
#error "Unable to find Doctest includes."
23
#endif
24
25
namespace
mimicpp::reporting::detail::doctest
26
{
27
using namespace
::doctest;
28
29
[[noreturn]]
30
inline
void
send_fail(
StringViewT
const
msg)
31
{
32
DOCTEST_FAIL(msg);
33
util::unreachable
();
34
}
35
36
inline
void
send_success(
StringViewT
const
msg)
37
{
38
DOCTEST_REQUIRE_MESSAGE(
true
, msg);
39
}
40
41
inline
void
send_warning(
StringViewT
const
msg)
42
{
43
DOCTEST_MESSAGE(msg);
44
}
45
}
46
47
namespace
mimicpp::reporting
48
{
49
// GCOVR_EXCL_START
50
59
using
DoctestReporterT
=
BasicReporter
<
60
&detail::doctest::send_success,
61
&detail::doctest::send_warning,
62
&detail::doctest::send_fail>;
63
64
// GCOVR_EXCL_STOP
65
}
66
67
namespace
mimicpp::reporting::detail::doctest
68
{
69
[[maybe_unused]]
70
inline
ReporterInstaller<DoctestReporterT>
const
installer{};
71
}
72
73
#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::DoctestReporterT
BasicReporter< &detail::doctest::send_success, &detail::doctest::send_warning, &detail::doctest::send_fail > DoctestReporterT
Reporter for the integration into Doctest.
Definition
Doctest.hpp:59
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
Doctest.hpp
Generated on
for mimic++ by
1.18.0