Boost logo

Boost :

From: Beman Dawes (beman_at_[hidden])
Date: 2000-12-01 11:50:19


A preliminary Test Tools Library has been uploaded at
http://www.egroups.com/files/boost/test_tools/

The real objective is to start regression run testing the boost libraries
in addition to the current compile testing.

I'm proposing boost use the simplest testing protocol; successful tests
return 0 while unsuccessful tests return non-zero.

Developers would be free to meet that protocol in any way.

The Test Tools library supplies a standard main() to catch exceptions,
and/or a couple of macros to facilitate actual value testing. Boost
developers don't have to use Test Tools; they are just a convenient way to
meet the protocol.

Here is the example from the docs:

   #include <boost/main.hpp>
   #include <boost/test_tools.hpp>

   int add( int i, int j ) { return i+j; }

   int test_main( int argc, char * argv[] ) // note the name!
   {
     // four ways to detect and report the same error:
     BOOST_TEST_VERIFY( add(2,2) == 4 ); // #1 continues on error
     BOOST_TEST_ASSERT( add(2,2) == 4 ); // #2 throws on error
     if ( add(2,2) != 4 ) throw "Oops..."; // #3 throws on error
     return add(2,2) == 4 ? 0 : 1; // #4 returns error directly
   }

#1 and #2 output error messages displaying the failed expression, the file
name, and the line number. In all cases, main() outputs an overall status
message.

Comments?

--Beman


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk