micro-test-plus 5.0.1
µTest++ Testing Framework
Loading...
Searching...
No Matches
exceptions.h
Go to the documentation of this file.
1/*
2 * This file is part of the µOS++ project (https://micro-os-plus.github.io/).
3 * Copyright (c) 2021-2026 Liviu Ionescu. All rights reserved.
4 *
5 * Permission to use, copy, modify, and/or distribute this software for any
6 * purpose is hereby granted, under the terms of the MIT license.
7 *
8 * If a copy of the license was not distributed with this file, it can be
9 * obtained from https://opensource.org/licenses/mit.
10 *
11 * Major parts of the code are inspired from v1.1.8 of the Boost UT project,
12 * released under the terms of the Boost Version 1.0 Software License,
13 * which can be obtained from https://www.boost.org/LICENSE_1_0.txt.
14 */
15
16// ----------------------------------------------------------------------------
17
38
39#ifndef MICRO_OS_PLUS_MICRO_TEST_PLUS_EXCEPTIONS_H_
40#define MICRO_OS_PLUS_MICRO_TEST_PLUS_EXCEPTIONS_H_
41
42// ----------------------------------------------------------------------------
43
44#if defined(__cplusplus)
45
46// ----------------------------------------------------------------------------
47
48#if __has_include("micro-os-plus/project-config.h")
49#include "micro-os-plus/project-config.h"
50#endif // __has_include("micro-os-plus/project-config.h")
51
52#if __has_include("micro-os-plus/micro-test-plus-defines.h")
53#include "micro-os-plus/micro-test-plus-defines.h"
54#endif // __has_include("micro-os-plus/micro-test-plus-defines.h")
55
56// ----------------------------------------------------------------------------
57
58#if defined(__GNUC__)
59#pragma GCC diagnostic push
60
61#pragma GCC diagnostic ignored "-Waggregate-return"
62#if defined(__clang__)
63#pragma clang diagnostic ignored "-Wc++98-compat"
64#endif // defined(__clang__)
65#endif // defined(__GNUC__)
66
67// ============================================================================
68
70{
71 // --------------------------------------------------------------------------
72
73#if defined(__cpp_exceptions)
74
85 template <class Exception_T, class Callable_T>
86 [[nodiscard]] constexpr auto
87 throws (const Callable_T& func);
88
98 template <class Callable_T>
99 [[nodiscard]] constexpr auto
100 throws (const Callable_T& func);
101
110 template <class Callable_T>
111 [[nodiscard]] constexpr auto
112 nothrow (const Callable_T& func);
113
114#endif // defined(__cpp_exceptions)
115
116 // --------------------------------------------------------------------------
117} // namespace micro_os_plus::micro_test_plus
118
119#if defined(__GNUC__)
120#pragma GCC diagnostic pop
121#endif // defined(__GNUC__)
122
123// ----------------------------------------------------------------------------
124
125#endif // defined(__cplusplus)
126
127// ============================================================================
128// Templates, inlines & constexpr implementations.
129
131
132// ----------------------------------------------------------------------------
133
134#endif // MICRO_OS_PLUS_MICRO_TEST_PLUS_EXCEPTIONS_H_
135
136// ----------------------------------------------------------------------------
C++ header file with inline implementations for the µTest++ exceptions comparators.
constexpr auto nothrow(const Callable_T &func)
Check if a callable does not throw an exception.
Primary namespace for the µTest++ testing framework.