MPL_TEST_CASE() { typedef enum_range_c<EC3,0,0> range0; typedef enum_range_c<EC3,0,1> range1; typedef enum_range_c<EC3> range3; MPL_ASSERT_RELATION( size<range0>::value, ==, 0 ); MPL_ASSERT_RELATION( size<range1>::value, ==, 1 ); MPL_ASSERT_RELATION( size<range3>::value, ==, 3 ); MPL_ASSERT(( empty<range0> )); MPL_ASSERT_NOT(( empty<range1> )); MPL_ASSERT_NOT(( empty<range3> )); MPL_ASSERT(( is_same< begin<range0>::type, end<range0>::type > )); MPL_ASSERT_NOT(( is_same<begin<range1>::type, end<range1>::type > )); MPL_ASSERT_NOT(( is_same<begin<range3>::type, end<range3>::type > )); // MPL_ASSERT_RELATION( front<range1>::type::value, ==, EC3::Enum0 ); // MPL_ASSERT_RELATION( back<range1>::type::value, ==, EC3::Enum0 ); // MPL_ASSERT_RELATION( front<range3>::type::value, ==, EC3::Enum0 ); // MPL_ASSERT_RELATION( back<range3>::type::value, ==, EC3::Enum2 ); MPL_ASSERT(( is_same<enum_c<EC3,front<range1>::type::value>, enum_c<EC3,EC3::Enum0> > )); MPL_ASSERT(( is_same< enum_c<EC3,back<range1>::type::value>, enum_c<EC3,EC3::Enum0> > )); MPL_ASSERT(( is_same< enum_c<EC3,front<range3>::type::value>, enum_c<EC3,EC3::Enum0> > )); MPL_ASSERT(( is_same< enum_c<EC3,back<range3>::type::value>, enum_c<EC3,EC3::Enum2> > )); }
MPL_TEST_CASE() { typedef vector0<> v0; typedef vector1<char> v1; typedef vector2<char,long> v2; typedef vector9<char,char,char,char,char,char,char,char,int> v9; MPL_ASSERT(( equal< v0,v0::type > )); MPL_ASSERT(( equal< v1,v1::type > )); MPL_ASSERT(( equal< v2,v2::type > )); MPL_ASSERT(( equal< v9,v9::type > )); MPL_ASSERT_RELATION( size<v0>::value, ==, 0 ); MPL_ASSERT_RELATION( size<v1>::value, ==, 1 ); MPL_ASSERT_RELATION( size<v2>::value, ==, 2 ); MPL_ASSERT_RELATION( size<v9>::value, ==, 9 ); MPL_ASSERT(( empty<v0> )); MPL_ASSERT_NOT(( empty<v1> )); MPL_ASSERT_NOT(( empty<v2> )); MPL_ASSERT_NOT(( empty<v9> )); MPL_ASSERT(( is_same< front<v1>::type,char > )); MPL_ASSERT(( is_same< back<v1>::type,char > )); MPL_ASSERT(( is_same< front<v2>::type,char > )); MPL_ASSERT(( is_same< back<v2>::type,long > )); MPL_ASSERT(( is_same< front<v9>::type,char > )); MPL_ASSERT(( is_same< back<v9>::type,int > )); }
MPL_TEST_CASE() { typedef set< char,int const,long*,UDT* const,incomplete,abstract , incomplete volatile&,abstract const& > s; MPL_ASSERT_RELATION( size<s>::value, ==, 8 ); MPL_ASSERT_NOT(( empty<s> )); MPL_ASSERT(( is_same< clear<s>::type, set0<> > )); MPL_ASSERT(( is_same< at<s,bool>::type, void_ > )); MPL_ASSERT(( has_key<s,char> )); MPL_ASSERT(( has_key<s,int const> )); MPL_ASSERT(( has_key<s,long*> )); MPL_ASSERT(( has_key<s,UDT* const> )); MPL_ASSERT(( has_key<s,incomplete> )); MPL_ASSERT(( has_key<s,abstract> )); MPL_ASSERT(( has_key<s,incomplete volatile&> )); MPL_ASSERT(( has_key<s,abstract const&> )); MPL_ASSERT_NOT(( has_key<s,char const> )); MPL_ASSERT_NOT(( has_key<s,int> )); MPL_ASSERT_NOT(( has_key<s,long* const> )); MPL_ASSERT_NOT(( has_key<s,UDT*> )); MPL_ASSERT_NOT(( has_key<s,incomplete const> )); MPL_ASSERT_NOT(( has_key<s,abstract volatile> )); MPL_ASSERT_NOT(( has_key<s,incomplete&> )); MPL_ASSERT_NOT(( has_key<s,abstract&> )); }
MPL_TEST_CASE() { MPL_ASSERT_NOT(( is_placeholder<int> )); MPL_ASSERT_NOT(( is_placeholder<UDT> )); MPL_ASSERT_NOT(( is_placeholder<incomplete> )); MPL_ASSERT_NOT(( is_placeholder<abstract> )); MPL_ASSERT_NOT(( is_placeholder<noncopyable> )); MPL_ASSERT(( is_placeholder<_> )); BOOST_PP_REPEAT( BOOST_MPL_LIMIT_METAFUNCTION_ARITY , AUX_IS_PLACEHOLDER_TEST , unused ) }
MPL_TEST_CASE() { typedef vector<int,char,long,short,char,long,double,long>::type types; MPL_ASSERT(( contains< types,short > )); MPL_ASSERT_NOT(( contains< types,unsigned > )); }
MPL_TEST_CASE() { // x == y || x == my || sizeof(x) == sizeof(y) typedef lambda< or_< boost::is_same<_1, _2> , boost::is_same<_2, my> , equal_to< sizeof_<_1>, sizeof_<_2> > > >::type f; MPL_ASSERT_NOT(( apply_wrap2<f,double,char> )); MPL_ASSERT_NOT(( apply_wrap2<f,my,int> )); MPL_ASSERT_NOT(( apply_wrap2<f,my,char[99]> )); MPL_ASSERT(( apply_wrap2<f,int,int> )); MPL_ASSERT(( apply_wrap2<f,my,my> )); MPL_ASSERT(( apply_wrap2<f,signed long, unsigned long> )); }
MPL_TEST_CASE() { // !(x == char) && !(x == double) || sizeof(x) > 8 typedef lambda< or_< and_< not_< boost::is_same<_1, char> > , not_< boost::is_float<_1> > > , greater< sizeof_<_1>, mpl::size_t<8> > > >::type f; MPL_ASSERT_NOT(( apply_wrap1<f,char> )); MPL_ASSERT_NOT(( apply_wrap1<f,double> )); MPL_ASSERT(( apply_wrap1<f,long> )); MPL_ASSERT(( apply_wrap1<f,my> )); }
MPL_TEST_CASE() { typedef list<> l0; typedef list<char> l1; typedef list<char,long> l2; typedef list<char,char,char,char,char,char,char,char,char> l9; MPL_ASSERT_RELATION(size<l0>::value, ==, 0); MPL_ASSERT_RELATION(size<l1>::value, ==, 1); MPL_ASSERT_RELATION(size<l2>::value, ==, 2); MPL_ASSERT_RELATION(size<l9>::value, ==, 9); MPL_ASSERT(( empty<l0> )); MPL_ASSERT_NOT(( empty<l1> )); MPL_ASSERT_NOT(( empty<l2> )); MPL_ASSERT_NOT(( empty<l9> )); MPL_ASSERT(( is_same<front<l1>::type,char> )); MPL_ASSERT(( is_same<front<l2>::type,char> )); MPL_ASSERT(( is_same<front<l9>::type,char> )); }
MPL_TEST_CASE() { typedef range_c<int,0,0> range0; typedef range_c<int,0,1> range1; typedef range_c<int,0,10> range10; MPL_ASSERT_RELATION( size<range0>::value, ==, 0 ); MPL_ASSERT_RELATION( size<range1>::value, ==, 1 ); MPL_ASSERT_RELATION( size<range10>::value, ==, 10 ); MPL_ASSERT(( empty<range0> )); MPL_ASSERT_NOT(( empty<range1> )); MPL_ASSERT_NOT(( empty<range10> )); MPL_ASSERT(( is_same< begin<range0>::type, end<range0>::type > )); MPL_ASSERT_NOT(( is_same<begin<range1>::type, end<range1>::type > )); MPL_ASSERT_NOT(( is_same<begin<range10>::type, end<range10>::type > )); MPL_ASSERT_RELATION( front<range1>::type::value, ==, 0 ); MPL_ASSERT_RELATION( back<range1>::type::value, ==, 0 ); MPL_ASSERT_RELATION( front<range10>::type::value, ==, 0 ); MPL_ASSERT_RELATION( back<range10>::type::value, ==, 9 ); }
MPL_TEST_CASE() { typedef deque<> d0; typedef deque<char> d1; typedef deque<char,long> d2; typedef deque<char,char,char,char,char,char,char,char,int> d9; MPL_ASSERT_RELATION( size<d0>::value, ==, 0 ); MPL_ASSERT_RELATION( size<d1>::value, ==, 1 ); MPL_ASSERT_RELATION( size<d2>::value, ==, 2 ); MPL_ASSERT_RELATION( size<d9>::value, ==, 9 ); MPL_ASSERT(( empty<d0> )); MPL_ASSERT_NOT(( empty<d1> )); MPL_ASSERT_NOT(( empty<d2> )); MPL_ASSERT_NOT(( empty<d9> )); MPL_ASSERT(( is_same< front<d1>::type,char > )); MPL_ASSERT(( is_same< back<d1>::type,char > )); MPL_ASSERT(( is_same< front<d2>::type,char > )); MPL_ASSERT(( is_same< back<d2>::type,long > )); MPL_ASSERT(( is_same< front<d9>::type,char > )); MPL_ASSERT(( is_same< back<d9>::type,int > )); }
MPL_TEST_CASE() { typedef push_front<list0<>,long>::type res1; typedef push_front<list1<long>,int>::type res2; typedef push_front<list2<int,long>,char>::type res3; MPL_ASSERT_RELATION( size<res1>::value, ==, 1 ); MPL_ASSERT_RELATION( size<res2>::value, ==, 2 ); MPL_ASSERT_RELATION( size<res3>::value, ==, 3 ); MPL_ASSERT(( is_same< front<res1>::type, long > )); MPL_ASSERT(( is_same< front<res2>::type, int > )); MPL_ASSERT(( is_same< front<res3>::type, char > )); MPL_ASSERT(( has_push_front< list0<> > )); MPL_ASSERT(( has_push_front< list1<long> > )); MPL_ASSERT_NOT(( has_push_back< list0<> > )); }
MPL_TEST_CASE() { MPL_ASSERT_NOT(( is_sequence< std_vector<int> > )); MPL_ASSERT_NOT(( is_sequence< int_<0> > )); MPL_ASSERT_NOT(( is_sequence< int > )); MPL_ASSERT_NOT(( is_sequence< int& > )); MPL_ASSERT_NOT(( is_sequence< UDT > )); MPL_ASSERT_NOT(( is_sequence< UDT* > )); MPL_ASSERT(( is_sequence< range_c<int,0,0> > )); MPL_ASSERT(( is_sequence< list<> > )); MPL_ASSERT(( is_sequence< list<int> > )); MPL_ASSERT(( is_sequence< vector<> > )); MPL_ASSERT(( is_sequence< vector<int> > )); }
MPL_TEST_CASE() { MPL_ASSERT_NOT(( aux::msvc_is_class< int > )); MPL_ASSERT_NOT(( aux::msvc_is_class< char > )); MPL_ASSERT_NOT(( aux::msvc_is_class< enum_ > )); MPL_ASSERT_NOT(( aux::msvc_is_class< char* > )); MPL_ASSERT_NOT(( aux::msvc_is_class< UDT* > )); MPL_ASSERT_NOT(( aux::msvc_is_class< UDT& > )); MPL_ASSERT_NOT(( aux::msvc_is_class< incomplete* > )); MPL_ASSERT_NOT(( aux::msvc_is_class< incomplete& > )); MPL_ASSERT_NOT(( aux::msvc_is_class< int[5] > )); MPL_ASSERT_NOT(( aux::msvc_is_class< void (*)() > )); MPL_ASSERT_NOT(( aux::msvc_is_class< int (*)(int, char) > )); MPL_ASSERT(( aux::msvc_is_class< UDT > )); MPL_ASSERT(( aux::msvc_is_class< incomplete > )); MPL_ASSERT(( aux::msvc_is_class< abstract > )); MPL_ASSERT(( aux::msvc_is_class< noncopyable > )); MPL_ASSERT(( aux::msvc_is_class< A<int> > )); MPL_ASSERT(( aux::msvc_is_class< A<incomplete> > )); }
MPL_TEST_CASE() { MPL_ASSERT(( empty< list0<> > )); MPL_ASSERT_NOT(( empty< list1<char> > )); }
MPL_TEST_CASE() { typedef s_mask<char,s_item<int,s_item<char, set0<> > > > s; MPL_ASSERT_RELATION( size<s>::value, ==, 1 ); MPL_ASSERT_NOT(( empty<s> )); MPL_ASSERT(( is_same< clear<s>::type, set0<> > )); MPL_ASSERT(( is_same< at<s,int>::type, int > )); MPL_ASSERT(( is_same< at<s,char>::type, void_ > )); MPL_ASSERT_NOT(( has_key<s,char> )); MPL_ASSERT(( has_key<s,int> )); MPL_ASSERT_RELATION( (order<s,int>::value), ==, 3 ); MPL_ASSERT(( is_same< order<s,char>::type, void_ > )); typedef begin<s>::type first; typedef end<s>::type last; MPL_ASSERT(( is_same< deref<first>::type, int > )); MPL_ASSERT(( is_same< next<first>::type, last > )); typedef s_unmask<char,s> s2; MPL_ASSERT_RELATION( size<s2>::value, ==, 2 ); MPL_ASSERT_NOT(( empty<s2> )); MPL_ASSERT(( is_same<clear<s2>::type, set0<> > )); MPL_ASSERT(( is_same<at<s2,int>::type, int > )); MPL_ASSERT(( is_same<at<s2,char>::type, char > )); MPL_ASSERT(( has_key<s2,char> )); MPL_ASSERT_NOT(( has_key<s2,long> )); MPL_ASSERT_RELATION( (order<s2,int>::value), ==, 3 ); MPL_ASSERT_RELATION( (order<s2,char>::value), ==, 2 ); typedef begin<s2>::type first2; typedef end<s2>::type last2; MPL_ASSERT(( is_same< first2::type, int > )); typedef next<first2>::type iter; MPL_ASSERT(( is_same< iter::type, char > )); MPL_ASSERT(( is_same< next<iter>::type, last2 > )); typedef insert<s2,int>::type s2_1; MPL_ASSERT(( is_same<s2, s2_1> )); typedef insert<s2,long>::type s3; MPL_ASSERT_RELATION( size<s3>::value, ==, 3 ); MPL_ASSERT(( has_key<s3,long> )); MPL_ASSERT(( has_key<s3,int> )); MPL_ASSERT(( has_key<s3,char> )); typedef insert<s,char>::type s1; MPL_ASSERT_RELATION( size<s1>::value, ==, 2 ); MPL_ASSERT(( is_same<at<s1,int>::type, int > )); MPL_ASSERT(( is_same<at<s1,char>::type, char > )); MPL_ASSERT_NOT(( is_same<s1, s2> )); typedef erase_key<s1,char>::type s_1; MPL_ASSERT(( is_same<s, s_1> )); MPL_ASSERT_RELATION( size<s_1>::value, ==, 1 ); MPL_ASSERT(( is_same< at<s_1,char>::type, void_ > )); MPL_ASSERT(( is_same< at<s_1,int>::type, int > )); }
MPL_TEST_CASE() { typedef set0<> s; MPL_ASSERT_RELATION( size<s>::value, ==, 0 ); MPL_ASSERT(( empty<s> )); MPL_ASSERT(( is_same< clear<s>::type, set0<> > )); MPL_ASSERT(( is_same< at<s,char>::type, void_ > )); MPL_ASSERT_NOT(( has_key<s,char> )); MPL_ASSERT_NOT(( has_key<s,int> )); MPL_ASSERT_NOT(( has_key<s,UDT> )); MPL_ASSERT_NOT(( has_key<s,incomplete> )); MPL_ASSERT_NOT(( has_key<s,char const> )); MPL_ASSERT_NOT(( has_key<s,int const> )); MPL_ASSERT_NOT(( has_key<s,UDT const> )); MPL_ASSERT_NOT(( has_key<s,incomplete const> )); MPL_ASSERT_NOT(( has_key<s,int*> )); MPL_ASSERT_NOT(( has_key<s,UDT*> )); MPL_ASSERT_NOT(( has_key<s,incomplete*> )); MPL_ASSERT_NOT(( has_key<s,int&> )); MPL_ASSERT_NOT(( has_key<s,UDT&> )); MPL_ASSERT_NOT(( has_key<s,incomplete&> )); typedef insert<s,char>::type s1; MPL_ASSERT_RELATION( size<s1>::value, ==, 1 ); MPL_ASSERT(( is_same< at<s1,char>::type, char > )); typedef erase_key<s,char>::type s0_1; MPL_ASSERT_RELATION( size<s0_1>::value, ==, 0 ); MPL_ASSERT(( is_same< at<s0_1,char>::type, void_ > )); }
MPL_TEST_CASE() { MPL_ASSERT_NOT(( greater_equal<_0, _10> )); MPL_ASSERT(( greater_equal<_10, _0> )); MPL_ASSERT(( greater_equal<_10, _10> )); }
MPL_TEST_CASE() { MPL_ASSERT(( less_equal<_0, _10> )); MPL_ASSERT_NOT(( less_equal<_10, _0> )); MPL_ASSERT(( less_equal<_10, _10> )); }
MPL_TEST_CASE() { MPL_ASSERT(( not_equal_to<_0, _10> )); MPL_ASSERT(( not_equal_to<_10, _0> )); MPL_ASSERT_NOT(( not_equal_to<_10, _10> )); }
MPL_TEST_CASE() { MPL_ASSERT(( apply1< same_as<int>,int > )); MPL_ASSERT_NOT(( apply1< same_as<int>,long > )); }
MPL_TEST_CASE() { typedef map0<> m; MPL_ASSERT_RELATION( size<m>::type::value, ==, 0 ); MPL_ASSERT(( empty<m>::type )); MPL_ASSERT(( is_same< clear<m>::type,map0<> > )); MPL_ASSERT(( is_same< at<m,char>::type,void_ > )); MPL_ASSERT_NOT(( has_key<m,char>::type )); MPL_ASSERT_NOT(( has_key<m,int>::type )); MPL_ASSERT_NOT(( has_key<m,UDT>::type )); MPL_ASSERT_NOT(( has_key<m,incomplete>::type )); MPL_ASSERT_NOT(( has_key<m,char const>::type )); MPL_ASSERT_NOT(( has_key<m,int const>::type )); MPL_ASSERT_NOT(( has_key<m,UDT const>::type )); MPL_ASSERT_NOT(( has_key<m,incomplete const>::type )); MPL_ASSERT_NOT(( has_key<m,int*>::type )); MPL_ASSERT_NOT(( has_key<m,UDT*>::type )); MPL_ASSERT_NOT(( has_key<m,incomplete*>::type )); MPL_ASSERT_NOT(( has_key<m,int&>::type )); MPL_ASSERT_NOT(( has_key<m,UDT&>::type )); MPL_ASSERT_NOT(( has_key<m,incomplete&>::type )); typedef insert<m,mpl::pair<char,int> >::type m1; MPL_ASSERT_RELATION( size<m1>::type::value, ==, 1 ); MPL_ASSERT(( is_same< at<m1,char>::type,int > )); typedef erase_key<m,char>::type m0_1; MPL_ASSERT_RELATION( size<m0_1>::type::value, ==, 0 ); MPL_ASSERT(( is_same< at<m0_1,char>::type,void_ > )); }
MPL_TEST_CASE() { typedef map2< mpl::pair<int,unsigned> , mpl::pair<char,unsigned char> > m_; typedef erase_key<m_,char>::type m; MPL_ASSERT_RELATION( size<m>::type::value, ==, 1 ); MPL_ASSERT_NOT(( empty<m> )); MPL_ASSERT(( is_same< clear<m>::type,map0<> > )); MPL_ASSERT(( is_same< at<m,int>::type,unsigned > )); MPL_ASSERT(( is_same< at<m,char>::type,void_ > )); MPL_ASSERT(( contains< m,mpl::pair<int,unsigned> > )); MPL_ASSERT_NOT(( contains< m,mpl::pair<int,int> > )); MPL_ASSERT_NOT(( contains< m,mpl::pair<char,unsigned char> > )); MPL_ASSERT_NOT(( has_key<m,char>::type )); MPL_ASSERT(( has_key<m,int>::type )); MPL_ASSERT_NOT(( is_same< order<m,int>::type, void_ > )); MPL_ASSERT(( is_same< order<m,char>::type,void_ > )); typedef begin<m>::type first; typedef end<m>::type last; MPL_ASSERT(( is_same< deref<first>::type,mpl::pair<int,unsigned> > )); MPL_ASSERT(( is_same< next<first>::type,last > )); typedef insert<m,mpl::pair<char,long> >::type m2; MPL_ASSERT_RELATION( size<m2>::type::value, ==, 2 ); MPL_ASSERT_NOT(( empty<m2>::type )); MPL_ASSERT(( is_same< clear<m2>::type,map0<> > )); MPL_ASSERT(( is_same< at<m2,int>::type,unsigned > )); MPL_ASSERT(( is_same< at<m2,char>::type,long > )); MPL_ASSERT(( contains< m2,mpl::pair<int,unsigned> > )); MPL_ASSERT_NOT(( contains< m2,mpl::pair<int,int> > )); MPL_ASSERT_NOT(( contains< m2,mpl::pair<char,unsigned char> > )); MPL_ASSERT(( contains< m2,mpl::pair<char,long> > )); MPL_ASSERT(( has_key<m2,char>::type )); MPL_ASSERT_NOT(( has_key<m2,long>::type )); MPL_ASSERT_NOT(( is_same< order<m2,int>::type, void_ > )); MPL_ASSERT_NOT(( is_same< order<m2,char>::type, void_ > )); MPL_ASSERT_NOT(( is_same< order<m2,char>::type, order<m2,int>::type > )); typedef begin<m2>::type first2; typedef end<m2>::type last2; MPL_ASSERT(( is_same<deref<first2>::type,mpl::pair<int,unsigned> > )); typedef next<first2>::type iter; MPL_ASSERT(( is_same<deref<iter>::type,mpl::pair<char,long> > )); MPL_ASSERT(( is_same< next<iter>::type,last2 > )); typedef insert<m2,mpl::pair<int,unsigned> >::type s2_1; MPL_ASSERT(( is_same<m2,s2_1> )); typedef insert<m2,mpl::pair<long,unsigned> >::type m3; MPL_ASSERT_RELATION( size<m3>::type::value, ==, 3 ); MPL_ASSERT(( has_key<m3,long>::type )); MPL_ASSERT(( has_key<m3,int>::type )); MPL_ASSERT(( has_key<m3,char>::type )); MPL_ASSERT(( contains< m3,mpl::pair<long,unsigned> > )); MPL_ASSERT(( contains< m3,mpl::pair<int,unsigned> > )); typedef insert<m,mpl::pair<char,long> >::type m1; MPL_ASSERT_RELATION( size<m1>::type::value, ==, 2 ); MPL_ASSERT(( is_same< at<m1,int>::type,unsigned > )); MPL_ASSERT(( is_same< at<m1,char>::type,long > )); MPL_ASSERT(( contains< m1,mpl::pair<int,unsigned> > )); MPL_ASSERT_NOT(( contains< m1,mpl::pair<int,int> > )); MPL_ASSERT_NOT(( contains< m1,mpl::pair<char,unsigned char> > )); MPL_ASSERT(( contains< m1,mpl::pair<char,long> > )); MPL_ASSERT(( is_same< m1,m2 > )); typedef erase_key<m1,char>::type m_1; MPL_ASSERT(( is_same<m,m_1> )); MPL_ASSERT_RELATION( size<m_1>::type::value, ==, 1 ); MPL_ASSERT(( is_same< at<m_1,char>::type,void_ > )); MPL_ASSERT(( is_same< at<m_1,int>::type,unsigned > )); typedef erase_key<m3,char>::type m2_1; MPL_ASSERT_RELATION( size<m2_1>::type::value, ==, 2 ); MPL_ASSERT(( is_same< at<m2_1,char>::type,void_ > )); MPL_ASSERT(( is_same< at<m2_1,int>::type,unsigned > )); MPL_ASSERT(( is_same< at<m2_1,long>::type,unsigned > )); }