deque_options_test.cpp 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. //////////////////////////////////////////////////////////////////////////////
  2. //
  3. // (C) Copyright Ion Gaztanaga 2004-2013. Distributed under the Boost
  4. // Software License, Version 1.0. (See accompanying file
  5. // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  6. //
  7. // See http://www.boost.org/libs/container for documentation.
  8. //
  9. //////////////////////////////////////////////////////////////////////////////
  10. #include <boost/container/deque.hpp>
  11. #include <boost/container/allocator.hpp>
  12. #include <boost/core/lightweight_test.hpp>
  13. using namespace boost::container;
  14. void test_block_bytes()
  15. {
  16. #if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES)
  17. using options_t = deque_options_t< block_bytes<128u> >;
  18. #else
  19. typedef deque_options< block_bytes<128u> >::type options_t;
  20. #endif
  21. typedef deque<unsigned short, void, options_t> deque_t;
  22. BOOST_TEST(deque_t::get_block_size() == 128u/sizeof(unsigned short));
  23. }
  24. void test_block_elements()
  25. {
  26. #if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES)
  27. using options_t = deque_options_t< block_size<64> >;
  28. #else
  29. typedef deque_options< block_size<64 > >::type options_t;
  30. #endif
  31. typedef deque<unsigned char, void, options_t> deque_t;
  32. BOOST_TEST(deque_t::get_block_size() == 64U);
  33. }
  34. int main()
  35. {
  36. test_block_bytes();
  37. test_block_elements();
  38. return ::boost::report_errors();
  39. }