From a63bc49cfb2d13b04a9ce348f44f488cb4696f8c Mon Sep 17 00:00:00 2001 From: Beman Dawes Date: Tue, 24 Mar 2009 15:28:27 +0000 Subject: [PATCH] Initial commit [SVN r51958] --- include/boost/detail/test_framework.hpp | 37 +++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 include/boost/detail/test_framework.hpp diff --git a/include/boost/detail/test_framework.hpp b/include/boost/detail/test_framework.hpp new file mode 100644 index 0000000..815ba68 --- /dev/null +++ b/include/boost/detail/test_framework.hpp @@ -0,0 +1,37 @@ +// test_framework.hpp ----------------------------------------------------------------// + +// Copyright Beman Dawes 2009 + +// Distributed under the Boost Software License, Version 1.0. +// See http://www.boost.org/LICENSE_1_0.txt + +// A very simple test framework that avoids dependencies on Boost.Test + +#include + +namespace boost +{ + namespace test_framework + { + int error_count = 0; + + void check( const char * predicate, const char * file, int line ) + { + ++error_count; + + // format chosen to parse with VC++ IDE output + std::cout << file << "(" << line << ") : error: " + << predicate << " is false\n" << std::endl; + } + + int errors() + { + std::cout << " ***** " << error_count << " error(s) detected *****\n"; + return error_count; + } + } // namespace test_framework +} // namespace boost + +#define BOOST_CHECK(predicate) \ + (predicate) ? static_cast(0) : \ + boost::test_framework::check( #predicate, __FILE__, __LINE__ )