mirror of
https://github.com/boostorg/smart_ptr.git
synced 2025-07-29 20:37:13 +02:00
Remove type2 tests in a_s_construct_test
This commit is contained in:
@ -10,30 +10,6 @@
|
||||
#if !defined(BOOST_NO_CXX11_ALLOCATOR)
|
||||
#include <boost/smart_ptr/allocate_shared_array.hpp>
|
||||
|
||||
class type1 {
|
||||
friend class std::allocator<type1>;
|
||||
|
||||
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<typename T>
|
||||
class creator {
|
||||
public:
|
||||
@ -75,189 +51,109 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
class type2 {
|
||||
friend class creator<type2>;
|
||||
class type {
|
||||
friend class creator<type>;
|
||||
|
||||
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<type1[]> a1 = boost::allocate_shared<type1[]>(std::allocator<void>(), 3);
|
||||
boost::shared_ptr<type[]> a1 = boost::allocate_shared<type[]>(creator<void>(), 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<type1[3]> a1 = boost::allocate_shared<type1[3]>(std::allocator<void>());
|
||||
boost::shared_ptr<type[3]> a1 = boost::allocate_shared<type[3]>(creator<void>());
|
||||
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<type1[][2]> a1 = boost::allocate_shared<type1[][2]>(std::allocator<void>(), 2);
|
||||
boost::shared_ptr<type[][2]> a1 = boost::allocate_shared<type[][2]>(creator<void>(), 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<type1[2][2]> a1 = boost::allocate_shared<type1[2][2]>(std::allocator<void>());
|
||||
boost::shared_ptr<type[2][2]> a1 = boost::allocate_shared<type[2][2]>(creator<void>());
|
||||
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<const type1[]> a1 = boost::allocate_shared<const type1[]>(std::allocator<void>(), 3);
|
||||
boost::shared_ptr<const type[]> a1 = boost::allocate_shared<const type[]>(creator<void>(), 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<const type1[3]> a1 = boost::allocate_shared<const type1[3]>(std::allocator<void>());
|
||||
boost::shared_ptr<const type[3]> a1 = boost::allocate_shared<const type[3]>(creator<void>());
|
||||
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<const type1[][2]> a1 = boost::allocate_shared<const type1[][2]>(std::allocator<void>(), 2);
|
||||
boost::shared_ptr<const type[][2]> a1 = boost::allocate_shared<const type[][2]>(creator<void>(), 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<const type1[2][2]> a1 = boost::allocate_shared<const type1[2][2]>(std::allocator<void>());
|
||||
boost::shared_ptr<const type[2][2]> a1 = boost::allocate_shared<const type[2][2]>(creator<void>());
|
||||
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<type2[]> a1 = boost::allocate_shared<type2[]>(creator<void>(), 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<type2[3]> a1 = boost::allocate_shared<type2[3]>(creator<void>());
|
||||
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<type2[][2]> a1 = boost::allocate_shared<type2[][2]>(creator<void>(), 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<type2[2][2]> a1 = boost::allocate_shared<type2[2][2]>(creator<void>());
|
||||
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<const type2[]> a1 = boost::allocate_shared<const type2[]>(creator<void>(), 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<const type2[3]> a1 = boost::allocate_shared<const type2[3]>(creator<void>());
|
||||
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<const type2[][2]> a1 = boost::allocate_shared<const type2[][2]>(creator<void>(), 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<const type2[2][2]> a1 = boost::allocate_shared<const type2[2][2]>(creator<void>());
|
||||
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();
|
||||
|
Reference in New Issue
Block a user