// Boost.Range library // // Copyright Neil Groves 2010. Use, modification and // distribution is subject to the Boost Software License, Version // 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) // // // For more information, see http://www.boost.org/libs/range/ // #include #include #include #include #include namespace { class MockClassWithoutIterators {}; template void test_has_range_iterator_impl(const bool expected_value) { BOOST_CHECK_EQUAL( boost::has_range_iterator::value, expected_value ); } template void test_has_range_const_iterator_impl(const bool expected_value) { BOOST_CHECK_EQUAL( boost::has_range_const_iterator::value, expected_value ); } void test_has_range_iterator() { test_has_range_iterator_impl< std::vector >(true); test_has_range_iterator_impl< MockClassWithoutIterators >(false); #ifndef BOOST_NO_CXX11_RVALUE_REFERENCES test_has_range_iterator_impl&&>(true); test_has_range_iterator_impl(false); #endif } void test_has_range_const_iterator() { test_has_range_const_iterator_impl< std::vector >(true); test_has_range_const_iterator_impl< MockClassWithoutIterators >(false); #ifndef BOOST_NO_CXX11_RVALUE_REFERENCES test_has_range_const_iterator_impl&&>(true); test_has_range_const_iterator_impl(false); #endif } } boost::unit_test::test_suite* init_unit_test_suite(int argc, char* argv[]) { boost::unit_test::test_suite* test = BOOST_TEST_SUITE( "RangeTestSuite.has_range_iterator" ); test->add(BOOST_TEST_CASE(&test_has_range_iterator)); test->add(BOOST_TEST_CASE(&test_has_range_const_iterator)); return test; }