Imported Upstream version 1.57.0
[platform/upstream/boost.git] / libs / mpl / test / stable_partition.cpp
1
2 // Copyright Aleksey Gurtovoy 2004
3 // Copyright Eric Friedman 2003
4 //
5 // Distributed under the Boost Software License, Version 1.0. 
6 // (See accompanying file LICENSE_1_0.txt or copy at 
7 // http://www.boost.org/LICENSE_1_0.txt)
8 //
9 // See http://www.boost.org/libs/mpl for documentation.
10
11 // $Id$
12 // $Date$
13 // $Revision$
14
15 #include <boost/mpl/stable_partition.hpp>
16
17 #include <boost/mpl/vector_c.hpp>
18 #include <boost/mpl/equal.hpp>
19 #include <boost/mpl/comparison.hpp>
20 #include <boost/mpl/int.hpp>
21 #include <boost/mpl/aux_/test.hpp>
22
23 typedef vector_c<int,3,4,0,-5,8,-1,7>::type numbers;
24 typedef vector_c<int,0,-5,-1>::type manual_first;
25 typedef vector_c<int,3,4,8,7>::type manual_second;
26
27 MPL_TEST_CASE()
28 {
29     typedef stable_partition<
30           numbers
31         , less< _, int_<3> >
32         >::type result;
33
34     MPL_ASSERT(( equal< result::first,manual_first > ));
35     MPL_ASSERT(( equal< result::second,manual_second > ));
36 }
37
38 MPL_TEST_CASE()
39 {
40     typedef stable_partition<
41           numbers
42         , greater_equal< _, int_<3> >
43         >::type result;
44
45     MPL_ASSERT(( equal< result::first,manual_second > ));
46     MPL_ASSERT(( equal< result::second,manual_first > ));
47 }