2014-01-23 20:40:46 -08:00
|
|
|
/*
|
2017-03-06 01:18:16 -05:00
|
|
|
Copyright 2012-2015 Glen Joseph Fernandes
|
|
|
|
(glenjofe@gmail.com)
|
2015-11-09 22:35:34 -05:00
|
|
|
|
2017-03-06 01:18:16 -05:00
|
|
|
Distributed under the Boost Software License, Version 1.0.
|
|
|
|
(http://www.boost.org/LICENSE_1_0.txt)
|
2015-11-09 22:35:34 -05:00
|
|
|
*/
|
2020-01-01 08:29:47 -05:00
|
|
|
#include <boost/core/lightweight_test.hpp>
|
2015-11-09 22:35:34 -05:00
|
|
|
#include <boost/smart_ptr/make_shared.hpp>
|
2014-01-23 20:40:46 -08:00
|
|
|
|
2015-11-09 22:35:34 -05:00
|
|
|
int main()
|
|
|
|
{
|
2014-01-23 20:40:46 -08:00
|
|
|
{
|
2017-03-06 01:18:16 -05:00
|
|
|
boost::shared_ptr<int[]> result =
|
|
|
|
boost::make_shared<int[]>(4, 1);
|
|
|
|
BOOST_TEST(result[0] == 1);
|
|
|
|
BOOST_TEST(result[1] == 1);
|
|
|
|
BOOST_TEST(result[2] == 1);
|
|
|
|
BOOST_TEST(result[3] == 1);
|
2014-01-23 20:40:46 -08:00
|
|
|
}
|
|
|
|
{
|
2017-03-06 01:18:16 -05:00
|
|
|
boost::shared_ptr<int[4]> result =
|
|
|
|
boost::make_shared<int[4]>(1);
|
|
|
|
BOOST_TEST(result[0] == 1);
|
|
|
|
BOOST_TEST(result[1] == 1);
|
|
|
|
BOOST_TEST(result[2] == 1);
|
|
|
|
BOOST_TEST(result[3] == 1);
|
2014-01-23 20:40:46 -08:00
|
|
|
}
|
|
|
|
{
|
2017-03-06 01:18:16 -05:00
|
|
|
boost::shared_ptr<const int[]> result =
|
|
|
|
boost::make_shared<const int[]>(4, 1);
|
|
|
|
BOOST_TEST(result[0] == 1);
|
|
|
|
BOOST_TEST(result[1] == 1);
|
|
|
|
BOOST_TEST(result[2] == 1);
|
|
|
|
BOOST_TEST(result[3] == 1);
|
2014-01-23 20:40:46 -08:00
|
|
|
}
|
|
|
|
{
|
2017-03-06 01:18:16 -05:00
|
|
|
boost::shared_ptr<const int[4]> result =
|
|
|
|
boost::make_shared<const int[4]>(1);
|
|
|
|
BOOST_TEST(result[0] == 1);
|
|
|
|
BOOST_TEST(result[1] == 1);
|
|
|
|
BOOST_TEST(result[2] == 1);
|
|
|
|
BOOST_TEST(result[3] == 1);
|
2014-01-23 20:40:46 -08:00
|
|
|
}
|
|
|
|
return boost::report_errors();
|
|
|
|
}
|