xtd 0.2.0
Loading...
Searching...
No Matches

◆ does_not_throw_

#define does_not_throw_ (   ...)

#include <xtd.tunit/include/xtd/tunit/assert.h>

Asserts that the staement does not throw an exception.

Parameters
statementThe statement that verify.
messageAn optional user message to display if the assertion fails. This message can be seen in the unit test results.
Remarks
Contains information about current file and current line.
Can be used with xtd::tunit::assert, xtd::tunit::assume and xtd::tunit::valid classes.
Examples
std::vector<int> v1 = {1, 2, 3, 4};
xtd::tunit::assert::does_not_throw_([&] {v1.at(2);}); // test ok.
xtd::tunit::assert::does_not_throw_([&] {v1.at(5);}, "User message..."); // test error.
xtd::tunit::assume::does_not_throw_([&] {v1.at(2);}); // test ok.
xtd::tunit::assume::does_not_throw_([&] {v1.at(5);}, "User message..."); // test error.
xtd::tunit::valid::does_not_throw_([&] {v1.at(2);}); // test ok.
xtd::tunit::valid::does_not_throw_([&] {v1.at(5);}, "User message..."); // test error.