xtd
0.2.0
Loading...
Searching...
No Matches
◆
throws()
[1/4]
template<typename exception_t >
static void xtd::tunit::assert::throws
(
const std::function< void()> &
statement
)
inline
static
Asserts that the statement throws a particular exception when called.
Template Parameters
exception_t
The exception type that must be throw.
Parameters
statement
The statement that verify.
Exceptions
xtd::tunit::assert_error
If bad assertion.
Examples
std::vector<int> v1 = {1, 2, 3, 4};
xtd::tunit::assert::throws<std::out_of_range>([&] {v1.at(5);});
// test ok.
xtd::tunit::assert::throws<std::out_of_range>([&] {v1.at(2);});
// test throws an assert_error exception.
xtd
tunit
assert
Generated on Sat Sep 14 2024 21:25:32 for xtd by
Gammasoft
. All rights reserved.