From 5008957bd0af370384d99a86c8f26789ba2afd61 Mon Sep 17 00:00:00 2001 From: Glen Fernandes Date: Wed, 5 Feb 2014 09:10:45 -0800 Subject: [PATCH] Remove type2 tests in a_s_construct_test --- test/allocate_shared_array_construct_test.cpp | 184 ++++-------------- 1 file changed, 40 insertions(+), 144 deletions(-) diff --git a/test/allocate_shared_array_construct_test.cpp b/test/allocate_shared_array_construct_test.cpp index 6501fa0..66acd0d 100644 --- a/test/allocate_shared_array_construct_test.cpp +++ b/test/allocate_shared_array_construct_test.cpp @@ -10,30 +10,6 @@ #if !defined(BOOST_NO_CXX11_ALLOCATOR) #include -class type1 { - friend class std::allocator; - -public: - static unsigned int instances; - static const type1 object; - -protected: - explicit type1() { - instances++; - } - - type1(const type1&) { - instances++; - } - - ~type1() { - instances--; - } -}; - -unsigned int type1::instances; -const type1 type1::object; - template class creator { public: @@ -75,189 +51,109 @@ public: } }; -class type2 { - friend class creator; +class type { + friend class creator; public: static unsigned int instances; - static const type2 object; + static const type object; protected: - explicit type2() { + explicit type() { instances++; } - type2(const type2&) { + type(const type&) { instances++; } - ~type2() { + ~type() { instances--; } }; -unsigned int type2::instances; -const type2 type2::object; +unsigned int type::instances; +const type type::object; int main() { - BOOST_TEST(type1::instances == 1); + BOOST_TEST(type::instances == 1); { - boost::shared_ptr a1 = boost::allocate_shared(std::allocator(), 3); + boost::shared_ptr a1 = boost::allocate_shared(creator(), 3); BOOST_TEST(a1.use_count() == 1); BOOST_TEST(a1.get() != 0); - BOOST_TEST(type1::instances == 4); + BOOST_TEST(type::instances == 4); a1.reset(); - BOOST_TEST(type1::instances == 1); + BOOST_TEST(type::instances == 1); } - BOOST_TEST(type1::instances == 1); + BOOST_TEST(type::instances == 1); { - boost::shared_ptr a1 = boost::allocate_shared(std::allocator()); + boost::shared_ptr a1 = boost::allocate_shared(creator()); BOOST_TEST(a1.use_count() == 1); BOOST_TEST(a1.get() != 0); - BOOST_TEST(type1::instances == 4); + BOOST_TEST(type::instances == 4); a1.reset(); - BOOST_TEST(type1::instances == 1); + BOOST_TEST(type::instances == 1); } - BOOST_TEST(type1::instances == 1); + BOOST_TEST(type::instances == 1); { - boost::shared_ptr a1 = boost::allocate_shared(std::allocator(), 2); + boost::shared_ptr a1 = boost::allocate_shared(creator(), 2); BOOST_TEST(a1.get() != 0); BOOST_TEST(a1.use_count() == 1); - BOOST_TEST(type1::instances == 5); + BOOST_TEST(type::instances == 5); a1.reset(); - BOOST_TEST(type1::instances == 1); + BOOST_TEST(type::instances == 1); } - BOOST_TEST(type1::instances == 1); + BOOST_TEST(type::instances == 1); { - boost::shared_ptr a1 = boost::allocate_shared(std::allocator()); + boost::shared_ptr a1 = boost::allocate_shared(creator()); BOOST_TEST(a1.get() != 0); BOOST_TEST(a1.use_count() == 1); - BOOST_TEST(type1::instances == 5); + BOOST_TEST(type::instances == 5); a1.reset(); - BOOST_TEST(type1::instances == 1); + BOOST_TEST(type::instances == 1); } - BOOST_TEST(type1::instances == 1); + BOOST_TEST(type::instances == 1); { - boost::shared_ptr a1 = boost::allocate_shared(std::allocator(), 3); + boost::shared_ptr a1 = boost::allocate_shared(creator(), 3); BOOST_TEST(a1.get() != 0); BOOST_TEST(a1.use_count() == 1); - BOOST_TEST(type1::instances == 4); + BOOST_TEST(type::instances == 4); a1.reset(); - BOOST_TEST(type1::instances == 1); + BOOST_TEST(type::instances == 1); } - BOOST_TEST(type1::instances == 1); + BOOST_TEST(type::instances == 1); { - boost::shared_ptr a1 = boost::allocate_shared(std::allocator()); + boost::shared_ptr a1 = boost::allocate_shared(creator()); BOOST_TEST(a1.get() != 0); BOOST_TEST(a1.use_count() == 1); - BOOST_TEST(type1::instances == 4); + BOOST_TEST(type::instances == 4); a1.reset(); - BOOST_TEST(type1::instances == 1); + BOOST_TEST(type::instances == 1); } - BOOST_TEST(type1::instances == 1); + BOOST_TEST(type::instances == 1); { - boost::shared_ptr a1 = boost::allocate_shared(std::allocator(), 2); + boost::shared_ptr a1 = boost::allocate_shared(creator(), 2); BOOST_TEST(a1.get() != 0); BOOST_TEST(a1.use_count() == 1); - BOOST_TEST(type1::instances == 5); + BOOST_TEST(type::instances == 5); a1.reset(); - BOOST_TEST(type1::instances == 1); + BOOST_TEST(type::instances == 1); } - BOOST_TEST(type1::instances == 1); + BOOST_TEST(type::instances == 1); { - boost::shared_ptr a1 = boost::allocate_shared(std::allocator()); + boost::shared_ptr a1 = boost::allocate_shared(creator()); BOOST_TEST(a1.get() != 0); BOOST_TEST(a1.use_count() == 1); - BOOST_TEST(type1::instances == 5); + BOOST_TEST(type::instances == 5); a1.reset(); - BOOST_TEST(type1::instances == 1); - } - - BOOST_TEST(type2::instances == 1); - { - boost::shared_ptr a1 = boost::allocate_shared(creator(), 3); - BOOST_TEST(a1.use_count() == 1); - BOOST_TEST(a1.get() != 0); - BOOST_TEST(type2::instances == 4); - a1.reset(); - BOOST_TEST(type2::instances == 1); - } - - BOOST_TEST(type2::instances == 1); - { - boost::shared_ptr a1 = boost::allocate_shared(creator()); - BOOST_TEST(a1.use_count() == 1); - BOOST_TEST(a1.get() != 0); - BOOST_TEST(type2::instances == 4); - a1.reset(); - BOOST_TEST(type2::instances == 1); - } - - BOOST_TEST(type2::instances == 1); - { - boost::shared_ptr a1 = boost::allocate_shared(creator(), 2); - BOOST_TEST(a1.get() != 0); - BOOST_TEST(a1.use_count() == 1); - BOOST_TEST(type2::instances == 5); - a1.reset(); - BOOST_TEST(type2::instances == 1); - } - - BOOST_TEST(type2::instances == 1); - { - boost::shared_ptr a1 = boost::allocate_shared(creator()); - BOOST_TEST(a1.get() != 0); - BOOST_TEST(a1.use_count() == 1); - BOOST_TEST(type2::instances == 5); - a1.reset(); - BOOST_TEST(type2::instances == 1); - } - - BOOST_TEST(type2::instances == 1); - { - boost::shared_ptr a1 = boost::allocate_shared(creator(), 3); - BOOST_TEST(a1.get() != 0); - BOOST_TEST(a1.use_count() == 1); - BOOST_TEST(type2::instances == 4); - a1.reset(); - BOOST_TEST(type2::instances == 1); - } - - BOOST_TEST(type2::instances == 1); - { - boost::shared_ptr a1 = boost::allocate_shared(creator()); - BOOST_TEST(a1.get() != 0); - BOOST_TEST(a1.use_count() == 1); - BOOST_TEST(type2::instances == 4); - a1.reset(); - BOOST_TEST(type2::instances == 1); - } - - BOOST_TEST(type2::instances == 1); - { - boost::shared_ptr a1 = boost::allocate_shared(creator(), 2); - BOOST_TEST(a1.get() != 0); - BOOST_TEST(a1.use_count() == 1); - BOOST_TEST(type2::instances == 5); - a1.reset(); - BOOST_TEST(type2::instances == 1); - } - - BOOST_TEST(type2::instances == 1); - { - boost::shared_ptr a1 = boost::allocate_shared(creator()); - BOOST_TEST(a1.get() != 0); - BOOST_TEST(a1.use_count() == 1); - BOOST_TEST(type2::instances == 5); - a1.reset(); - BOOST_TEST(type2::instances == 1); + BOOST_TEST(type::instances == 1); } return boost::report_errors();