Imported Upstream version 1.72.0
[platform/upstream/boost.git] / libs / bimap / test / test_bimap_extra.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 https://web.archive.org/web/20071014014301/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 // Boost.Test
21 #include <boost/test/minimal.hpp>
22
23 #include <boost/static_assert.hpp>
24 #include <boost/type_traits/is_same.hpp>
25
26 // Boost.Bimap
27 #include <boost/bimap/support/lambda.hpp>
28 #include <boost/bimap/bimap.hpp>
29 #include <boost/bimap/list_of.hpp>
30
31 // Support metafunctions
32 #include <boost/bimap/support/data_type_by.hpp>
33 #include <boost/bimap/support/key_type_by.hpp>
34 #include <boost/bimap/support/map_type_by.hpp>
35 #include <boost/bimap/support/value_type_by.hpp>
36 #include <boost/bimap/support/iterator_type_by.hpp>
37 #include <boost/bimap/relation/support/pair_type_by.hpp>
38
39 using namespace boost::bimaps;
40 using namespace boost::bimaps::support;
41 using namespace boost::bimaps::relation::support ;
42
43 typedef bimap<int, unconstrained_set_of<double> > bm_type;
44
45 namespace support_metafunctions_test {
46
47     typedef boost::is_same
48     <
49         data_type_by< member_at::left , bm_type >::type,
50         key_type_by < member_at::right, bm_type >::type
51
52     >::type test_metafunction_1;
53     BOOST_STATIC_ASSERT(test_metafunction_1::value);
54
55     typedef boost::is_same
56     <
57         data_type_by< member_at::right, bm_type >::type,
58         key_type_by < member_at::left , bm_type >::type
59
60     >::type test_metafunction_2;
61     BOOST_STATIC_ASSERT(test_metafunction_2::value);
62
63     typedef boost::is_same
64     <
65         map_type_by  < member_at::left , bm_type >::type::value_type,
66         value_type_by< member_at::left , bm_type >::type
67
68     >::type test_metafunction_3;
69     BOOST_STATIC_ASSERT(test_metafunction_3::value);
70
71     typedef boost::is_same
72     <
73         pair_type_by< member_at::left, bm_type::relation>::type,
74         value_type_by< member_at::left , bm_type >::type
75
76     >::type test_metafunction_4;
77     BOOST_STATIC_ASSERT(test_metafunction_4::value);
78     
79 } // namespace support_metafunctions_test
80
81 void test_bimap_extra()
82 {
83     // extra tests
84     // ---------------------------------------------------------------
85     // This section test small things... when a group of this checks
86     // can be related it is moved to a separate unit test file.
87
88
89
90 }
91
92
93 int test_main( int, char* [] )
94 {
95     test_bimap_extra();
96     return 0;
97 }
98