slist_test.cpp 2.4 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/slist.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 slist<int, ShmemAllocator> MyList;
  22. //typedef allocator<volatile int, managed_shared_memory::segment_manager> ShmemVolatileAllocator;
  23. //typedef slist<volatile int, ShmemVolatileAllocator> MyVolatileList;
  24. typedef allocator<test::movable_int, managed_shared_memory::segment_manager> ShmemMoveAllocator;
  25. typedef slist<test::movable_int, ShmemMoveAllocator> MyMoveList;
  26. typedef allocator<test::movable_and_copyable_int, managed_shared_memory::segment_manager> ShmemCopyMoveAllocator;
  27. typedef slist<test::movable_and_copyable_int, ShmemCopyMoveAllocator> MyCopyMoveList;
  28. typedef allocator<test::copyable_int, managed_shared_memory::segment_manager> ShmemCopyAllocator;
  29. typedef slist<test::copyable_int, ShmemCopyAllocator> MyCopyList;
  30. int main ()
  31. {
  32. if(test::list_test<managed_shared_memory, MyList, false>())
  33. return 1;
  34. if(test::list_test<managed_shared_memory, MyMoveList, false>())
  35. return 1;
  36. if(test::list_test<managed_shared_memory, MyCopyMoveList, false>())
  37. return 1;
  38. // if(test::list_test<managed_shared_memory, MyVolatileList, false>())
  39. // return 1;
  40. if(test::list_test<managed_shared_memory, MyCopyList, false>())
  41. return 1;
  42. const test::EmplaceOptions Options = (test::EmplaceOptions)
  43. (test::EMPLACE_FRONT | test::EMPLACE_AFTER | test::EMPLACE_BEFORE | test::EMPLACE_AFTER);
  44. if(!boost::interprocess::test::test_emplace
  45. < slist<test::EmplaceInt>, Options>())
  46. return 1;
  47. }
  48. #include <boost/interprocess/detail/config_end.hpp>