// Copyright Aleksey Gurtovoy 2000-2004 // // Distributed under 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) // // See http://www.boost.org/libs/mpl for documentation. // $Id$ // $Date$ // $Revision$ #include #include #include #include #include namespace test { namespace { #if !BOOST_WORKAROUND(BOOST_MSVC, <= 1300) template< typename S, typename S::value_type k > struct at_c : at< S, integral_c >::type { }; #else template< typename S, long k > struct at_c : aux::msvc_eti_base< at< S, integral_c > > { }; #endif }} #if !BOOST_WORKAROUND(BOOST_MSVC, <= 1200) MPL_TEST_CASE() { typedef set_c::type s1; typedef set_c::type s2; typedef set_c::type s3; MPL_ASSERT_RELATION( size::value, ==, 1 ); MPL_ASSERT_RELATION( size::value, ==, 1 ); MPL_ASSERT_RELATION( size::value, ==, 2 ); MPL_ASSERT(( is_same< s1::value_type, bool > )); MPL_ASSERT(( is_same< s3::value_type, bool > )); MPL_ASSERT(( is_same< s2::value_type, bool > )); #if !BOOST_WORKAROUND(BOOST_MSVC, <= 1300) MPL_ASSERT_RELATION( ( test::at_c::value ), ==, true ); MPL_ASSERT_RELATION( ( test::at_c::value ), ==, false ); MPL_ASSERT_RELATION( ( test::at_c::value ), ==, true ); MPL_ASSERT_RELATION( ( test::at_c::value ), ==, false ); MPL_ASSERT(( is_same< test::at_c::type, void_ > )); MPL_ASSERT(( is_same< test::at_c::type, void_ > )); #endif typedef begin::type first1; typedef end::type last1; MPL_ASSERT_RELATION( (distance::value), ==, 1 ); typedef begin::type first2; typedef end::type last2; MPL_ASSERT_RELATION( (distance::value), ==, 1 ); typedef begin::type first3; typedef end::type last3; MPL_ASSERT_RELATION( (distance::value), ==, 2 ); } #endif MPL_TEST_CASE() { typedef set_c::type s1; typedef set_c::type s2; MPL_ASSERT_RELATION( size::value, ==, 1 ); MPL_ASSERT_RELATION( size::value, ==, 8 ); MPL_ASSERT(( is_same< s1::value_type, char > )); MPL_ASSERT(( is_same< s2::value_type, char > )); #if !BOOST_WORKAROUND(BOOST_MSVC, <= 1300) MPL_ASSERT_RELATION( ( test::at_c::value ), ==, 'a' ); MPL_ASSERT_RELATION( ( test::at_c::value ), ==, 'a' ); MPL_ASSERT_RELATION( ( test::at_c::value ), ==, 'd' ); MPL_ASSERT_RELATION( ( test::at_c::value ), ==, 'h' ); MPL_ASSERT(( is_same< test::at_c::type, void_ > )); MPL_ASSERT(( is_same< test::at_c::type, void_ > )); #endif typedef begin::type first1; typedef end::type last1; MPL_ASSERT_RELATION( (distance::value), ==, 1 ); typedef begin::type first2; typedef end::type last2; MPL_ASSERT_RELATION( (distance::value), ==, 8 ); }