Example #1
0
void test_copy()
{
    DerivedContainer derived;
    derived.insert( new Derived );
    derived.insert( new Derived );

    BaseContainer base( derived );
    BOOST_CHECK_EQUAL( derived.size(), base.size() );
    base.clear();
    base = derived;
    BOOST_CHECK_EQUAL( derived.size(), base.size() );
    base = base;
}
void map_container_assignment_test()
{
    DerivedContainer derived;
    std::string foo( "foo" );
    std::string bar( "foo" );
    derived.insert( foo, new Derived );
    derived.insert( bar, new Derived );

    BaseContainer base_container( derived );
    BOOST_CHECK_EQUAL( derived.size(), base_container.size() );
    base_container.clear();
    base_container = derived;
    BOOST_CHECK_EQUAL( derived.size(), base_container.size() );
    
    BaseContainer base2( base_container );
    BOOST_CHECK_EQUAL( base2.size(), base_container.size() );
    base2 = base_container;
    BOOST_CHECK_EQUAL( base2.size(), base_container.size() );
    base_container = base_container;
}
Example #3
0
void container_assignment_test()
{
    BOOST_MESSAGE( "starting container assignment test" );

    DerivedContainer derived;
    set_capacity<DerivedContainer>()( derived );
    derived.insert( derived.begin(), new Derived );
    derived.insert( derived.begin(), new Derived );

    BaseContainer base( derived );
    BOOST_CHECK_EQUAL( derived.size(), base.size() );
    base.clear();
    base = derived;
    BOOST_CHECK_EQUAL( derived.size(), base.size() );
    BaseContainer base2( base );
    BOOST_CHECK_EQUAL( base2.size(), base.size() );
    base2 = base;
    BOOST_CHECK_EQUAL( base2.size(), base.size() );
    base = base;

    BOOST_MESSAGE( "finished container assignment test" );
}