mimic++ v4
Loading...
Searching...
No Matches
Doctest.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_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{
52 &detail::doctest::send_success,
53 &detail::doctest::send_warning,
54 &detail::doctest::send_fail
55 >;
56}
57
58namespace mimicpp::detail::doctest
59{
60 inline const ReporterInstaller<DoctestReporterT> installer{};
61}
62
63#endif
A reporter, which creates text messages and reports them via the provided callbacks.
Definition Reporter.hpp:336
Definition BoostTest.hpp:20
void unreachable()
Invokes undefined behavior.
Definition Utility.hpp:93
std::basic_string_view< CharT, CharTraitsT > StringViewT
Definition Fwd.hpp:208