From fd022e2d86e71a17bc89b756a3777e2ebf911b35 Mon Sep 17 00:00:00 2001 From: Edward Diener Date: Fri, 20 May 2016 05:22:20 -0400 Subject: [PATCH] Added documentation and tests for BOOST_TEST_NOT. --- doc/lightweight_test.qbk | 12 ++++++++++++ test/lightweight_test_test.cpp | 10 ++++++++++ 2 files changed, 22 insertions(+) diff --git a/doc/lightweight_test.qbk b/doc/lightweight_test.qbk index 7b706c3..4b9abd1 100644 --- a/doc/lightweight_test.qbk +++ b/doc/lightweight_test.qbk @@ -32,6 +32,7 @@ When using `lightweight_test.hpp`, *do not forget* to `` #define BOOST_TEST(expression) /*unspecified*/ +#define BOOST_TEST_NOT(expression) /*unspecified*/ #define BOOST_ERROR(message) /*unspecified*/ #define BOOST_TEST_EQ(expr1, expr2) /*unspecified*/ #define BOOST_TEST_NE(expr1, expr2) /*unspecified*/ @@ -56,6 +57,17 @@ message containing `expression`. [endsect] +[section BOOST_TEST_NOT] + +`` +BOOST_TEST_NOT(expression) +`` + +If expression is true increases the error count and outputs a +message containing `!(expression)`. + +[endsect] + [section BOOST_ERROR] `` diff --git a/test/lightweight_test_test.cpp b/test/lightweight_test_test.cpp index a5193f2..d4808a1 100644 --- a/test/lightweight_test_test.cpp +++ b/test/lightweight_test_test.cpp @@ -43,6 +43,16 @@ int main() BOOST_TEST( x++ == 1 ); BOOST_TEST( x == 2? true: false ); BOOST_TEST( x == 2? &x: 0 ); + + // BOOST_TEST_NOT + + BOOST_TEST_NOT( x == 1 ); + BOOST_TEST_NOT( ++x == 2 ); + BOOST_TEST_NOT( x++ == 2 ); + BOOST_TEST_NOT( --x == 2 ); + BOOST_TEST_NOT( x-- == 2 ); + BOOST_TEST_NOT( x == 2? false: true ); + BOOST_TEST_NOT( x == 2? 0: &x ); // BOOST_TEST_EQ