make_shared_array_value_test.cpp 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /*
  2. Copyright 2012-2015 Glen Joseph Fernandes
  3. (glenjofe@gmail.com)
  4. Distributed under the Boost Software License, Version 1.0.
  5. (http://www.boost.org/LICENSE_1_0.txt)
  6. */
  7. #include <boost/detail/lightweight_test.hpp>
  8. #include <boost/smart_ptr/make_shared.hpp>
  9. int main()
  10. {
  11. {
  12. boost::shared_ptr<int[]> result =
  13. boost::make_shared<int[]>(4, 1);
  14. BOOST_TEST(result[0] == 1);
  15. BOOST_TEST(result[1] == 1);
  16. BOOST_TEST(result[2] == 1);
  17. BOOST_TEST(result[3] == 1);
  18. }
  19. {
  20. boost::shared_ptr<int[4]> result =
  21. boost::make_shared<int[4]>(1);
  22. BOOST_TEST(result[0] == 1);
  23. BOOST_TEST(result[1] == 1);
  24. BOOST_TEST(result[2] == 1);
  25. BOOST_TEST(result[3] == 1);
  26. }
  27. {
  28. boost::shared_ptr<const int[]> result =
  29. boost::make_shared<const int[]>(4, 1);
  30. BOOST_TEST(result[0] == 1);
  31. BOOST_TEST(result[1] == 1);
  32. BOOST_TEST(result[2] == 1);
  33. BOOST_TEST(result[3] == 1);
  34. }
  35. {
  36. boost::shared_ptr<const int[4]> result =
  37. boost::make_shared<const int[4]>(1);
  38. BOOST_TEST(result[0] == 1);
  39. BOOST_TEST(result[1] == 1);
  40. BOOST_TEST(result[2] == 1);
  41. BOOST_TEST(result[3] == 1);
  42. }
  43. return boost::report_errors();
  44. }