/Src/Dependencies/Boost/libs/test/doc/src/examples/example08.cpp

http://hadesmem.googlecode.com/ · C++ · 34 lines · 22 code · 9 blank · 3 comment · 0 complexity · b0380724f96cc924efc8c4565d127b3c MD5 · raw file

  1. #define BOOST_TEST_ALTERNATIVE_INIT_API
  2. #include <boost/test/included/unit_test.hpp>
  3. #include <boost/test/floating_point_comparison.hpp>
  4. #include <boost/test/parameterized_test.hpp>
  5. #include <boost/bind.hpp>
  6. using namespace boost::unit_test;
  7. using namespace boost;
  8. //____________________________________________________________________________//
  9. class test_class {
  10. public:
  11. void test_method( double const& d )
  12. {
  13. BOOST_CHECK_CLOSE( d * 100, (double)(int)(d*100), 0.01 );
  14. }
  15. } tester;
  16. //____________________________________________________________________________//
  17. bool init_unit_test()
  18. {
  19. double params[] = { 1., 1.1, 1.01, 1.001, 1.0001 };
  20. callback1<double> tm = bind( &test_class::test_method, &tester, _1);
  21. framework::master_test_suite().
  22. add( BOOST_PARAM_TEST_CASE( tm, params, params+5 ) );
  23. return true;
  24. }
  25. //____________________________________________________________________________//