test_case_template_example.cpp 868 B

1234567891011121314151617181920212223242526272829303132333435
  1. // (C) Copyright Gennadiy Rozental 2001-2006.
  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. // Boost.Test
  7. #ifdef BOOST_MSVC
  8. # pragma warning(disable: C4345)
  9. #endif
  10. #include <boost/test/unit_test.hpp>
  11. using boost::unit_test::test_suite;
  12. // Boost.MPL
  13. #include <boost/mpl/range_c.hpp>
  14. BOOST_TEST_CASE_TEMPLATE_FUNCTION( free_test_function, Number )
  15. {
  16. BOOST_CHECK_EQUAL( 2, static_cast<int>(Number::value) );
  17. }
  18. test_suite* init_unit_test_suite( int, char* [] )
  19. {
  20. test_suite* test= BOOST_TEST_SUITE( "Test case template example" );
  21. typedef boost::mpl::range_c<int,0,10> numbers;
  22. test->add( BOOST_TEST_CASE_TEMPLATE( free_test_function, numbers ) );
  23. return test;
  24. }
  25. // EOF