Move two tests for allocate_shared and make_shared within check for BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX

[SVN r81669]
This commit is contained in:
Glen Fernandes
2012-12-02 10:17:05 +00:00
parent cfd4152291
commit 19283a3548
2 changed files with 30 additions and 31 deletions

View File

@ -25,20 +25,6 @@ int main() {
BOOST_TEST(a1[1][0] == 2);
BOOST_TEST(a1[1][1] == 3);
}
{
boost::shared_ptr<int[][2]> a1 = boost::allocate_shared<int[][2]>(std::allocator<int>(), 2, {0, 1});
BOOST_TEST(a1[0][0] == 0);
BOOST_TEST(a1[0][1] == 1);
BOOST_TEST(a1[1][0] == 0);
BOOST_TEST(a1[1][1] == 1);
}
{
boost::shared_ptr<int[][2][2]> a1 = boost::allocate_shared<int[][2][2]>(std::allocator<int>(), 2, { {0, 1}, {2, 3} });
BOOST_TEST(a1[0][0][0] == 0);
BOOST_TEST(a1[0][0][1] == 1);
BOOST_TEST(a1[1][1][0] == 2);
BOOST_TEST(a1[1][1][1] == 3);
}
#endif
#if !defined(BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX)
{
@ -55,6 +41,20 @@ int main() {
BOOST_TEST(a1[1][0] == 2);
BOOST_TEST(a1[1][1] == 3);
}
{
boost::shared_ptr<int[][2]> a1 = boost::allocate_shared<int[][2]>(std::allocator<int>(), 2, {0, 1});
BOOST_TEST(a1[0][0] == 0);
BOOST_TEST(a1[0][1] == 1);
BOOST_TEST(a1[1][0] == 0);
BOOST_TEST(a1[1][1] == 1);
}
{
boost::shared_ptr<int[][2][2]> a1 = boost::allocate_shared<int[][2][2]>(std::allocator<int>(), 2, { {0, 1}, {2, 3} });
BOOST_TEST(a1[0][0][0] == 0);
BOOST_TEST(a1[0][0][1] == 1);
BOOST_TEST(a1[1][1][0] == 2);
BOOST_TEST(a1[1][1][1] == 3);
}
{
boost::shared_ptr<int[2][2]> a1 = boost::allocate_shared<int[2][2]>(std::allocator<int>(), {0, 1});
BOOST_TEST(a1[0][0] == 0);

View File

@ -8,7 +8,6 @@
*/
#include <boost/detail/lightweight_test.hpp>
#include <boost/smart_ptr/make_shared_array.hpp>
#include <string>
int main() {
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
@ -26,6 +25,22 @@ int main() {
BOOST_TEST(a1[1][0] == 2);
BOOST_TEST(a1[1][1] == 3);
}
#endif
#if !defined(BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX)
{
boost::shared_ptr<int[4]> a1 = boost::make_shared<int[4]>({0, 1, 2, 3});
BOOST_TEST(a1[0] == 0);
BOOST_TEST(a1[1] == 1);
BOOST_TEST(a1[2] == 2);
BOOST_TEST(a1[3] == 3);
}
{
boost::shared_ptr<int[2][2]> a1 = boost::make_shared<int[2][2]>({ {0, 1}, {2, 3} });
BOOST_TEST(a1[0][0] == 0);
BOOST_TEST(a1[0][1] == 1);
BOOST_TEST(a1[1][0] == 2);
BOOST_TEST(a1[1][1] == 3);
}
{
boost::shared_ptr<int[][2]> a1 = boost::make_shared<int[][2]>(2, {0, 1});
BOOST_TEST(a1[0][0] == 0);
@ -40,22 +55,6 @@ int main() {
BOOST_TEST(a1[1][1][0] == 2);
BOOST_TEST(a1[1][1][1] == 3);
}
#endif
#if !defined(BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX)
{
boost::shared_ptr<int[4]> a1 = boost::make_shared<int[4]>({0, 1, 2, 3});
BOOST_TEST(a1[0] == 0);
BOOST_TEST(a1[1] == 1);
BOOST_TEST(a1[2] == 2);
BOOST_TEST(a1[3] == 3);
}
{
boost::shared_ptr<int[2][2]> a1 = boost::make_shared<int[2][2]>({ {0, 1}, {2, 3} });
BOOST_TEST(a1[0][0] == 0);
BOOST_TEST(a1[0][1] == 1);
BOOST_TEST(a1[1][0] == 2);
BOOST_TEST(a1[1][1] == 3);
}
{
boost::shared_ptr<int[2][2]> a1 = boost::make_shared<int[2][2]>({ 0, 1 });
BOOST_TEST(a1[0][0] == 0);