micro-test-plus 3.2.2
µTest++ Testing Framework
Loading...
Searching...
No Matches
micro_os_plus::micro_test_plus::detail::throws_< Callable_T, Exception_T > Struct Template Reference

Operator struct template to check if an expression throws a specific exception. More...

#include <micro-os-plus/micro-test-plus.h>

Inheritance diagram for micro_os_plus::micro_test_plus::detail::throws_< Callable_T, Exception_T >:

Public Member Functions

constexpr throws_ (const Callable_T &func)
 Constructs an exception checking operator for the given callable.
constexpr operator bool () const
 Conversion operator to boolean.

Public Attributes

const bool value_ {}
 Stores the result of the exception check.

Detailed Description

template<class Callable_T, class Exception_T = void>
struct micro_os_plus::micro_test_plus::detail::throws_< Callable_T, Exception_T >
Template Parameters
Callable_TThe type of the callable object to be invoked.
Exception_TThe type of the exception to check for (defaults to void for any exception).

The throws_ struct template provides a type-safe mechanism for verifying whether a callable expression throws a specified exception type during its execution within the framework.

This comparator is designed to support both custom and standard callable types. The result of the exception check is stored in the value_ member for efficient access.

The implementation is optimised for use in embedded environments and supports both compile-time and run-time evaluation.

All definitions are intended for internal use within the framework and are implemented in the include/micro-os-plus/micro-test-plus folder to maintain a structured and modular codebase.

Definition at line 1511 of file detail.h.

Constructor & Destructor Documentation

◆ throws_()

template<class Callable_T, class Exception_T = void>
micro_os_plus::micro_test_plus::detail::throws_< Callable_T, Exception_T >::throws_ ( const Callable_T & func)
inlineexplicitconstexpr
Parameters
funcThe callable object to be invoked.

Invokes the provided callable and determines whether it throws an exception of the specified type. The result is stored in the value_ member for efficient access.

Definition at line 1524 of file detail.h.

Member Function Documentation

◆ operator bool()

template<class Callable_T, class Exception_T = void>
micro_os_plus::micro_test_plus::detail::throws_< Callable_T, Exception_T >::operator bool ( ) const
inlinenodiscardconstexpr
Parameters
None.
Return values
trueThe callable throws the specified exception type.
falseThe callable does not throw the specified exception type.

Returns the result of the exception check.

Definition at line 1556 of file detail.h.

Member Data Documentation

◆ value_

template<class Callable_T, class Exception_T = void>
const bool micro_os_plus::micro_test_plus::detail::throws_< Callable_T, Exception_T >::value_ {}

Definition at line 1564 of file detail.h.


The documentation for this struct was generated from the following file: