]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/bimap/test/test_bimap_property_map.cpp
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / libs / bimap / test / test_bimap_property_map.cpp
1 // Boost.Bimap
2 //
3 // Copyright (c) 2006-2007 Matias Capeletto
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 // VC++ 8.0 warns on usage of certain Standard Library and API functions that
10 // can be cause buffer overruns or other possible security issues if misused.
11 // See http://msdn.microsoft.com/msdnmag/issues/05/05/SafeCandC/default.aspx
12 // But the wording of the warning is misleading and unsettling, there are no
13 // portable alternative functions, and VC++ 8.0's own libraries use the
14 // functions in question. So turn off the warnings.
15 #define _CRT_SECURE_NO_DEPRECATE
16 #define _SCL_SECURE_NO_DEPRECATE
17
18 #include <boost/config.hpp>
19
20 // std
21 #include <set>
22 #include <map>
23 #include <cstddef>
24 #include <cassert>
25 #include <algorithm>
26
27 // Boost.Test
28 #include <boost/test/minimal.hpp>
29
30 // Boost.Bimap
31
32 #include <boost/bimap/set_of.hpp>
33 #include <boost/bimap/property_map/set_support.hpp>
34
35 #include <boost/bimap/unordered_set_of.hpp>
36 #include <boost/bimap/property_map/unordered_set_support.hpp>
37
38 #include <boost/bimap/bimap.hpp>
39
40
41 template <class Map>
42 void test_readable_property_map(
43 Map m,
44 typename boost::property_traits<Map>:: key_type const & key,
45 typename boost::property_traits<Map>::value_type const & value
46 )
47 {
48 // TODO Add STATIC_ASSERT(
49 // boost::property_traits<Map>::category is readable )
50
51 BOOST_CHECK( get(m,key) == value );
52 //BOOST_CHECK( m[key] == value );
53 }
54
55
56 void test_bimap_property_map()
57 {
58 using namespace boost::bimaps;
59
60 typedef bimap< set_of<int>, unordered_set_of<double> > bm;
61
62 bm b;
63 b.insert( bm::value_type(1,0.1) );
64 b.insert( bm::value_type(2,0.2) );
65 b.insert( bm::value_type(3,0.3) );
66
67 test_readable_property_map(b.left , 1,0.1);
68 test_readable_property_map(b.right,0.1, 1);
69 }
70
71 int test_main( int, char* [] )
72 {
73 test_bimap_property_map();
74 return 0;
75 }
76