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