test_bimap_extra.cpp 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  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. // VC++ 8.0 warns on usage of certain Standard Library and API functions that
  9. // can be cause buffer overruns or other possible security issues if misused.
  10. // See https://web.archive.org/web/20071014014301/http://msdn.microsoft.com/msdnmag/issues/05/05/SafeCandC/default.aspx
  11. // But the wording of the warning is misleading and unsettling, there are no
  12. // portable alternative functions, and VC++ 8.0's own libraries use the
  13. // functions in question. So turn off the warnings.
  14. #define _CRT_SECURE_NO_DEPRECATE
  15. #define _SCL_SECURE_NO_DEPRECATE
  16. #include <boost/config.hpp>
  17. // Boost.Test
  18. #include <boost/test/minimal.hpp>
  19. #include <boost/static_assert.hpp>
  20. #include <boost/type_traits/is_same.hpp>
  21. // Boost.Bimap
  22. #include <boost/bimap/support/lambda.hpp>
  23. #include <boost/bimap/bimap.hpp>
  24. #include <boost/bimap/list_of.hpp>
  25. // Support metafunctions
  26. #include <boost/bimap/support/data_type_by.hpp>
  27. #include <boost/bimap/support/key_type_by.hpp>
  28. #include <boost/bimap/support/map_type_by.hpp>
  29. #include <boost/bimap/support/value_type_by.hpp>
  30. #include <boost/bimap/support/iterator_type_by.hpp>
  31. #include <boost/bimap/relation/support/pair_type_by.hpp>
  32. using namespace boost::bimaps;
  33. using namespace boost::bimaps::support;
  34. using namespace boost::bimaps::relation::support ;
  35. typedef bimap<int, unconstrained_set_of<double> > bm_type;
  36. namespace support_metafunctions_test {
  37. typedef boost::is_same
  38. <
  39. data_type_by< member_at::left , bm_type >::type,
  40. key_type_by < member_at::right, bm_type >::type
  41. >::type test_metafunction_1;
  42. BOOST_STATIC_ASSERT(test_metafunction_1::value);
  43. typedef boost::is_same
  44. <
  45. data_type_by< member_at::right, bm_type >::type,
  46. key_type_by < member_at::left , bm_type >::type
  47. >::type test_metafunction_2;
  48. BOOST_STATIC_ASSERT(test_metafunction_2::value);
  49. typedef boost::is_same
  50. <
  51. map_type_by < member_at::left , bm_type >::type::value_type,
  52. value_type_by< member_at::left , bm_type >::type
  53. >::type test_metafunction_3;
  54. BOOST_STATIC_ASSERT(test_metafunction_3::value);
  55. typedef boost::is_same
  56. <
  57. pair_type_by< member_at::left, bm_type::relation>::type,
  58. value_type_by< member_at::left , bm_type >::type
  59. >::type test_metafunction_4;
  60. BOOST_STATIC_ASSERT(test_metafunction_4::value);
  61. } // namespace support_metafunctions_test
  62. void test_bimap_extra()
  63. {
  64. // extra tests
  65. // ---------------------------------------------------------------
  66. // This section test small things... when a group of this checks
  67. // can be related it is moved to a separate unit test file.
  68. }
  69. int test_main( int, char* [] )
  70. {
  71. test_bimap_extra();
  72. return 0;
  73. }