1
0
forked from boostorg/core
Files
boost_core/doc/lightweight_test.qbk

89 lines
1.4 KiB
Plaintext
Raw Normal View History

[section:lightweight_test Header <boost/core/lightweight_test.hpp>]
2014-06-02 14:08:28 -07:00
[section BOOST_TEST]
``
BOOST_TEST(expression)
``
If expression is false increases the error count and outputs a
message containing `expression`.
2014-06-02 14:08:28 -07:00
[endsect]
[section BOOST_ERROR]
``
2014-06-02 14:08:28 -07:00
BOOST_ERROR(message)
``
Increases error count and outputs a message containing
`message`.
2014-06-02 14:08:28 -07:00
[endsect]
[section BOOST_TEST_EQ]
``
2014-06-02 14:08:28 -07:00
BOOST_TEST_EQ(expr1, expr2)
``
If `expr1` != `expr2` increases the error count and outputs a
message containing both expressions.
2014-06-02 14:08:28 -07:00
[endsect]
[section BOOST_TEST_NE]
``
2014-06-02 14:08:28 -07:00
BOOST_TEST_NE(expr1, expr2)
``
If `expr1` == `expr2` increases the error count and outputs a
message containing both expressions.
2014-06-02 14:08:28 -07:00
[endsect]
[section BOOST_TEST_THROWS]
``
2014-06-02 14:08:28 -07:00
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.
2014-06-02 14:08:28 -07:00
[endsect]
[section report_errors]
``
2014-06-02 14:08:28 -07:00
int boost::report_errors()
``
2014-06-02 14:08:28 -07:00
Return the error count from `main`.
Example:
``
2014-06-02 14:08:28 -07:00
#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]
2014-06-02 14:08:28 -07:00
[endsect]