list_test.cpp 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. //////////////////////////////////////////////////////////////////////////////
  2. //
  3. // (C) Copyright Ion Gaztanaga 2004-2012. 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/interprocess for documentation.
  8. //
  9. //////////////////////////////////////////////////////////////////////////////
  10. #include <boost/interprocess/detail/config_begin.hpp>
  11. #include <boost/interprocess/managed_shared_memory.hpp>
  12. #include <boost/interprocess/containers/list.hpp>
  13. #include <boost/interprocess/allocators/allocator.hpp>
  14. #include <boost/interprocess/offset_ptr.hpp>
  15. #include "dummy_test_allocator.hpp"
  16. #include "list_test.hpp"
  17. #include "movable_int.hpp"
  18. #include "emplace_test.hpp"
  19. using namespace boost::interprocess;
  20. typedef allocator<int, managed_shared_memory::segment_manager> ShmemAllocator;
  21. typedef list<int, ShmemAllocator> MyList;
  22. //typedef allocator<volatile int, managed_shared_memory::segment_manager> ShmemVolatileAllocator;
  23. //typedef list<volatile int, ShmemVolatileAllocator> MyVolatileList;
  24. typedef allocator<test::movable_int, managed_shared_memory::segment_manager> ShmemMoveAllocator;
  25. typedef list<test::movable_int, ShmemMoveAllocator> MyMoveList;
  26. typedef allocator<test::movable_and_copyable_int, managed_shared_memory::segment_manager> ShmemCopyMoveAllocator;
  27. typedef list<test::movable_and_copyable_int, ShmemCopyMoveAllocator> MyCopyMoveList;
  28. typedef allocator<test::copyable_int, managed_shared_memory::segment_manager> ShmemCopyAllocator;
  29. typedef list<test::copyable_int, ShmemCopyAllocator> MyCopyList;
  30. int main ()
  31. {
  32. if(test::list_test<managed_shared_memory, MyList, true>())
  33. return 1;
  34. // if(test::list_test<managed_shared_memory, MyVolatileList, true>())
  35. // return 1;
  36. if(test::list_test<managed_shared_memory, MyMoveList, true>())
  37. return 1;
  38. if(test::list_test<managed_shared_memory, MyCopyMoveList, true>())
  39. return 1;
  40. if(test::list_test<managed_shared_memory, MyCopyList, true>())
  41. return 1;
  42. const test::EmplaceOptions Options = (test::EmplaceOptions)(test::EMPLACE_BACK | test::EMPLACE_FRONT | test::EMPLACE_BEFORE);
  43. if(!boost::interprocess::test::test_emplace<list<test::EmplaceInt>, Options>())
  44. return 1;
  45. return 0;
  46. }
  47. #include <boost/interprocess/detail/config_end.hpp>