mimic++ v6
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#include "mimic++/Reporter.hpp"
12
13#if __has_include(<doctest/doctest.h>)
14 #include <doctest/doctest.h>
15#else
16 #error "Unable to find Doctest includes."
17#endif
18
19namespace mimicpp::detail::doctest
20{
21 using namespace ::doctest;
22
23 [[noreturn]]
24 inline void send_fail(const StringViewT msg)
25 {
26 DOCTEST_FAIL(msg);
28 }
29
30 inline void send_success(const StringViewT msg)
31 {
32 DOCTEST_REQUIRE_MESSAGE(true, msg);
33 }
34
35 inline void send_warning(const StringViewT msg)
36 {
37 DOCTEST_MESSAGE(msg);
38 }
39}
40
41namespace mimicpp
42{
43 // GCOVR_EXCL_START
44
54 &detail::doctest::send_success,
55 &detail::doctest::send_warning,
56 &detail::doctest::send_fail>;
57
58 // GCOVR_EXCL_STOP
59}
60
61namespace mimicpp::detail::doctest
62{
63 [[maybe_unused]]
64 inline const ReporterInstaller<DoctestReporterT> installer{};
65}
66
67#endif
A reporter, which creates text messages and reports them via the provided callbacks.
Definition Reporter.hpp:356
BasicReporter< &detail::doctest::send_success, &detail::doctest::send_warning, &detail::doctest::send_fail > DoctestReporterT
Reporter for the integration into Doctest.
Definition Doctest.hpp:53
Definition BoostTest.hpp:20
void unreachable()
Invokes undefined behavior.
Definition Utility.hpp:91
std::basic_string_view< CharT, CharTraitsT > StringViewT
Definition Fwd.hpp:345