Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/boost_1_34_1/libs/mpl/test/count.cpp @ 33

Last change on this file since 33 was 29, checked in by landauf, 16 years ago

updated boost from 1_33_1 to 1_34_1

File size: 1.4 KB
RevLine 
[29]1
2// Copyright Aleksey Gurtovoy 2000-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/count.cpp,v $
11// $Date: 2004/09/02 15:41:35 $
12// $Revision: 1.5 $
13
14#include <boost/mpl/count.hpp>
15
16#include <boost/mpl/vector.hpp>
17#include <boost/mpl/vector_c.hpp>
18#include <boost/mpl/integral_c.hpp>
19#include <boost/mpl/aux_/test.hpp>
20
21MPL_TEST_CASE()
22{
23    typedef vector<int,char,long,short,char,long,double,long> types;
24
25    MPL_ASSERT_RELATION( (count<types,int>::value), ==, 1 );
26    MPL_ASSERT_RELATION( (count<types,double>::value), ==, 1 );
27    MPL_ASSERT_RELATION( (count<types,char>::value), ==, 2 );
28    MPL_ASSERT_RELATION( (count<types,long>::value), ==, 3 );
29    MPL_ASSERT_RELATION( (count<types,unsigned>::value), ==, 0 );
30}
31   
32MPL_TEST_CASE()
33{
34    typedef vector_c<int,1,0,5,1,7,5,0,5> values;
35
36    MPL_ASSERT_RELATION( (count< values, integral_c<int,1> >::value), ==, 2 );
37    MPL_ASSERT_RELATION( (count< values, integral_c<int,0> >::value), ==, 2 );
38    MPL_ASSERT_RELATION( (count< values, integral_c<int,5> >::value), ==, 3 );
39    MPL_ASSERT_RELATION( (count< values, integral_c<int,7> >::value), ==, 1 );
40    MPL_ASSERT_RELATION( (count< values, integral_c<int,8> >::value), ==, 0 );
41}
Note: See TracBrowser for help on using the repository browser.