external_main_example_1.cpp 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. // (C) Copyright Gennadiy Rozental 2001-2014.
  2. // Distributed under the Boost Software License, Version 1.0.
  3. // (See accompanying file LICENSE_1_0.txt or copy at
  4. // http://www.boost.org/LICENSE_1_0.txt)
  5. // See http://www.boost.org/libs/test for the library home page.
  6. //
  7. // ***************************************************************************
  8. #ifndef BOOST_TEST_DYN_LINK
  9. #define BOOST_TEST_DYN_LINK
  10. #endif
  11. #include <boost/test/unit_test.hpp>
  12. #include <boost/bind.hpp>
  13. using namespace boost::unit_test;
  14. //____________________________________________________________________________//
  15. void free_test_function( int i, int j )
  16. {
  17. BOOST_TEST( i == j );
  18. }
  19. //____________________________________________________________________________//
  20. bool
  21. init_function()
  22. {
  23. framework::master_test_suite().
  24. add( BOOST_TEST_CASE( boost::bind( &free_test_function, 1, 1 ) ) );
  25. framework::master_test_suite().
  26. add( BOOST_TEST_CASE( boost::bind( &free_test_function, 1, 2 ) ) );
  27. framework::master_test_suite().
  28. add( BOOST_TEST_CASE( boost::bind( &free_test_function, 2, 1 ) ) );
  29. // do your own initialization here
  30. // if it successful return true
  31. // But, you CAN'T use testing tools here
  32. return true;
  33. }
  34. //____________________________________________________________________________//
  35. int
  36. main( int argc, char* argv[] )
  37. {
  38. return ::boost::unit_test::unit_test_main( &init_function, argc, argv );
  39. }
  40. //____________________________________________________________________________//