micro-test-plus
4.1.0
µTest++ Testing Framework
Toggle main menu visibility
Loading...
Searching...
No Matches
exceptions-inline.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
40
41
#ifndef MICRO_TEST_PLUS_EXCEPTIONS_INLINES_H_
42
#define MICRO_TEST_PLUS_EXCEPTIONS_INLINES_H_
43
44
// ----------------------------------------------------------------------------
45
46
#ifdef __cplusplus
47
48
// ----------------------------------------------------------------------------
49
50
#if defined(__GNUC__)
51
#pragma GCC diagnostic push
52
#pragma GCC diagnostic ignored "-Waggregate-return"
53
#if defined(__clang__)
54
#pragma clang diagnostic ignored "-Wc++98-compat"
55
#pragma clang diagnostic ignored "-Wc++98-compat-pedantic"
56
#endif
57
#endif
58
59
// ============================================================================
60
61
namespace
micro_os_plus::micro_test_plus
62
{
63
// --------------------------------------------------------------------------
64
// Exceptions related comparators.
65
66
#if defined(__cpp_exceptions)
67
78
template
<
class
Exception_T,
class
Callable_T>
79
constexpr
auto
80
throws
(
const
Callable_T& func)
81
{
82
return
detail::throws_<Callable_T, Exception_T>
{ func };
83
}
84
95
template
<
class
Callable_T>
96
constexpr
auto
97
throws
(
const
Callable_T& func)
98
{
99
return
detail::throws_<Callable_T>
{ func };
100
}
101
113
template
<
class
Callable_T>
114
constexpr
auto
115
nothrow
(
const
Callable_T& func)
116
{
117
return
detail::nothrow_<Callable_T>
{ func };
118
}
119
120
#endif
// defined(__cpp_exceptions)
121
122
// --------------------------------------------------------------------------
123
}
// namespace micro_os_plus::micro_test_plus
124
125
#if defined(__GNUC__)
126
#pragma GCC diagnostic pop
127
#endif
128
129
// ----------------------------------------------------------------------------
130
131
#endif
// __cplusplus
132
133
// ----------------------------------------------------------------------------
134
135
#endif
// MICRO_TEST_PLUS_EXCEPTIONS_INLINE_H_
136
137
// ----------------------------------------------------------------------------
micro_os_plus::micro_test_plus::nothrow
constexpr auto nothrow(const Callable_T &func)
Check if a callable does not throw an exception.
Definition
exceptions-inline.h:115
micro_os_plus::micro_test_plus
Primary namespace for the µTest++ testing framework.
micro_os_plus::micro_test_plus::detail::nothrow_
Operator struct template to check if an expression does not throw any exception.
Definition
detail.h:702
micro_os_plus::micro_test_plus::detail::throws_
Operator struct template to check if an expression throws a specific exception.
Definition
detail.h:645
include
micro-os-plus
micro-test-plus
inlines
exceptions-inline.h
Generated by
1.17.0