Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/boost_1_33_1/libs/mpl/test/joint_view.cpp @ 28

Last change on this file since 28 was 12, checked in by landauf, 17 years ago

added boost

File size: 1.4 KB
Line 
1
2// Copyright Aleksey Gurtovoy 2001-2004
3//
4// Distributed under the Boost Software License, Version 1.0.
5// (See accompanying file LICENSE_1_0.txt or copy at
6// http://www.boost.org/LICENSE_1_0.txt)
7//
8// See http://www.boost.org/libs/mpl for documentation.
9
10// $Source: /cvsroot/boost/boost/libs/mpl/test/joint_view.cpp,v $
11// $Date: 2004/10/01 16:32:41 $
12// $Revision: 1.5 $
13
14#include <boost/mpl/joint_view.hpp>
15
16#include <boost/mpl/range_c.hpp>
17#include <boost/mpl/list.hpp>
18#include <boost/mpl/equal.hpp>
19#include <boost/mpl/size.hpp>
20#include <boost/mpl/aux_/test.hpp>
21
22
23MPL_TEST_CASE()
24{
25    typedef joint_view<
26          range_c<int,0,10>
27        , range_c<int,10,15>
28        > numbers;
29
30    typedef range_c<int,0,15> answer;
31
32    MPL_ASSERT(( equal<numbers,answer> ));
33    MPL_ASSERT_RELATION( size<numbers>::value, ==, 15 );
34}
35
36template< typename View > struct test_is_empty
37{
38    typedef typename begin<View>::type first_;
39    typedef typename end<View>::type last_;
40   
41    MPL_ASSERT_RELATION( size<View>::value, ==, 0 );
42    MPL_ASSERT(( is_same< first_,last_> ));
43   
44    MPL_ASSERT_INSTANTIATION( View );
45    MPL_ASSERT_INSTANTIATION( first_ );
46    MPL_ASSERT_INSTANTIATION( last_ );
47};
48
49MPL_TEST_CASE()
50{
51    test_is_empty< joint_view< list0<>,list0<> > >();
52    test_is_empty< joint_view< list<>,list0<> > >();
53    test_is_empty< joint_view< list<>,list<> > >();
54    test_is_empty< joint_view< list<>, joint_view< list0<>,list0<> > > >();
55}
Note: See TracBrowser for help on using the repository browser.