diff --git a/test/Jamfile b/test/Jamfile index 46ff34e..400126f 100644 --- a/test/Jamfile +++ b/test/Jamfile @@ -30,6 +30,8 @@ test-suite iterator [ run filter_iterator_test.cpp ] [ run reverse_iterator_test.cpp ] [ run counting_iterator_test.cpp ] + [ run permutation_iterator_test.cpp : : : # on + ] [ run ../../utility/iterator_adaptor_examples.cpp ] [ run ../../utility/counting_iterator_example.cpp ] diff --git a/test/iterator_adaptor_test.cpp b/test/iterator_adaptor_test.cpp index f59fc6e..79b9001 100644 --- a/test/iterator_adaptor_test.cpp +++ b/test/iterator_adaptor_test.cpp @@ -30,13 +30,6 @@ struct my_iterator_tag : public std::random_access_iterator_tag { }; using boost::dummyT; -#if BOOST_WORKAROUND(BOOST_MSVC, == 1300) -typedef std::pair intpair; -BOOST_TT_BROKEN_COMPILER_SPEC(intpair) -BOOST_TT_BROKEN_COMPILER_SPEC(dummyT) -#endif - - struct mult_functor { typedef int result_type; typedef int argument_type; diff --git a/test/permutation_iterator_test.cpp b/test/permutation_iterator_test.cpp index 0b05ba2..f409698 100644 --- a/test/permutation_iterator_test.cpp +++ b/test/permutation_iterator_test.cpp @@ -9,6 +9,7 @@ #include #include +#include #include #include @@ -23,8 +24,9 @@ void permutation_test() typedef std::list< int > index_type; const int element_range_size = 10; - const int index_size = 4; + const int index_size = 7; + BOOST_STATIC_ASSERT(index_size <= element_range_size); element_range_type elements( element_range_size ); for( element_range_type::iterator el_it = elements.begin(); el_it != elements.end(); ++el_it ) { *el_it = std::distance(elements.begin(), el_it); } @@ -34,57 +36,42 @@ void permutation_test() { *i_it = element_range_size - index_size + std::distance(indices.begin(), i_it); } std::reverse( indices.begin(), indices.end() ); -#ifdef BOOST_MSVC - - typedef boost::permutation_iterator< element_range_type::iterator - , index_type::iterator - , boost::use_default - , boost::use_default - , element_range_type::reference > permutation_type; - - permutation_type begin( elements.begin(), indices.begin() ); - permutation_type it = begin; - permutation_type end( elements.begin(), indices.end() ); - -#else - typedef boost::permutation_iterator< element_range_type::iterator, index_type::iterator > permutation_type; permutation_type begin = boost::make_permutation_iterator( elements.begin(), indices.begin() ); permutation_type it = begin; permutation_type end = boost::make_permutation_iterator( elements.begin(), indices.end() ); -#endif - BOOST_CHECK( it == begin ); BOOST_CHECK( it != end ); BOOST_CHECK( std::distance( begin, end ) == index_size ); - for( index_type::iterator i_it = indices.begin(); it != end; ++i_it, ++it ) + for( index_type::iterator i_it1 = indices.begin(); it != end; ++i_it1, ++it ) { - BOOST_CHECK( *it == elements[ *i_it ] ); + BOOST_CHECK( *it == elements[ *i_it1 ] ); } it = begin; - for( int i = 0; i < index_size ; i+=2, it+=2 ) + for( int i1 = 0; i1 < index_size - 1 ; i1+=2, it+=2 ) { - index_type::iterator i_it = indices.begin(); std::advance( i_it, i ); - BOOST_CHECK( *it == elements[ *i_it ] ); + index_type::iterator i_it2 = indices.begin(); + std::advance( i_it2, i1 ); + BOOST_CHECK( *it == elements[ *i_it2 ] ); } it = begin + (index_size); - BOOST_CHECK( it != begin ); - for( index_type::iterator i_it = --indices.end(); it-- != begin; --i_it ) + for( index_type::iterator i_it3 = indices.end(); it != begin; ) { - BOOST_CHECK( *it == elements[ *i_it ] ); + BOOST_CHECK( *--it == elements[ *--i_it3 ] ); } - it = begin + (index_size - 1); - for( int i = 0; i < index_size; i+=2, it-=2 ) + it = begin + index_size; + for( int i2 = 0; i2 < index_size - 1; i2+=2, --it ) { - index_type::iterator i_it = --indices.end(); std::advance( i_it, -i ); - BOOST_CHECK( *it == elements[ *i_it ] ); + index_type::iterator i_it4 = --indices.end(); + std::advance( i_it4, -i2 ); + BOOST_CHECK( *--it == elements[ *i_it4 ] ); } } @@ -93,9 +80,5 @@ void permutation_test() int test_main(int, char *[]) { permutation_test(); - - bool error_on_purpose = false; - //BOOST_CHECK( error_on_purpose ); - return 0; } diff --git a/test/transform_iterator_test.cpp b/test/transform_iterator_test.cpp index fcbb3d9..cc73846 100644 --- a/test/transform_iterator_test.cpp +++ b/test/transform_iterator_test.cpp @@ -24,11 +24,6 @@ #include -#if BOOST_WORKAROUND(BOOST_MSVC, == 1300) -typedef std::pair intpair; -BOOST_TT_BROKEN_COMPILER_SPEC(intpair) -#endif - #ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION namespace boost { namespace detail {