mirror of
https://github.com/boostorg/core.git
synced 2025-05-11 05:07:39 +00:00
100 lines
1.5 KiB
Plaintext
100 lines
1.5 KiB
Plaintext
[section:lightweight_test lightweight_test]
|
|
|
|
[section Authors]
|
|
|
|
* Peter Dimov
|
|
* Beman Dawes
|
|
|
|
[endsect]
|
|
|
|
[section Header <boost/core/lightweight_test.hpp>]
|
|
|
|
[section BOOST_TEST]
|
|
|
|
``
|
|
BOOST_TEST(expression)
|
|
``
|
|
|
|
If expression is false increases the error count and outputs a
|
|
message containing `expression`.
|
|
|
|
[endsect]
|
|
|
|
[section BOOST_ERROR]
|
|
|
|
``
|
|
BOOST_ERROR(message)
|
|
``
|
|
|
|
Increases error count and outputs a message containing
|
|
`message`.
|
|
|
|
[endsect]
|
|
|
|
[section BOOST_TEST_EQ]
|
|
|
|
``
|
|
BOOST_TEST_EQ(expr1, expr2)
|
|
``
|
|
|
|
If `expr1` != `expr2` increases the error count and outputs a
|
|
message containing both expressions.
|
|
|
|
[endsect]
|
|
|
|
[section BOOST_TEST_NE]
|
|
|
|
``
|
|
BOOST_TEST_NE(expr1, expr2)
|
|
``
|
|
|
|
If `expr1` == `expr2` increases the error count and outputs a
|
|
message containing both expressions.
|
|
|
|
[endsect]
|
|
|
|
[section BOOST_TEST_THROWS]
|
|
|
|
``
|
|
BOOST_TEST_THROWS(expr, excep)
|
|
``
|
|
|
|
If BOOST_NO_EXCEPTIONS is NOT defined and if `expr` does not
|
|
throw an exception of type `excep`, increases the error count
|
|
and outputs a message containing the expression.
|
|
|
|
If BOOST_NO_EXCEPTIONS is defined, this macro expands to
|
|
nothing and `expr` is not evaluated.
|
|
|
|
[endsect]
|
|
|
|
[section report_errors]
|
|
|
|
``
|
|
int boost::report_errors()
|
|
``
|
|
|
|
Return the error count from `main`.
|
|
|
|
Example:
|
|
|
|
``
|
|
#include <boost/core/lightweight_test.hpp>
|
|
|
|
void sqr( int x ); // should return x * x
|
|
|
|
int main()
|
|
{
|
|
BOOST_TEST( sqr( 2 ) == 4 );
|
|
BOOST_TEST_EQ( sqr(-3), 9 );
|
|
|
|
return boost::report_errors();
|
|
}
|
|
``
|
|
|
|
[endsect]
|
|
|
|
[endsect]
|
|
|
|
[endsect]
|