Ejemplo n.º 1
0
void tst_Q3ValueVector::capacity()
{
    QFETCH( QByteArray, ba );
    Q3ValueVector<int> vector;

    QDataStream ds( &ba, IO_ReadWrite );
    ds >> vector;

    QVERIFY( vector.capacity() >= vector.size() );
}
Ejemplo n.º 2
0
void tst_Q3ValueVector::reserve()
{
    QFETCH( QByteArray, ba );
    Q3ValueVector<int> vector;

    QDataStream ds( &ba, IO_ReadWrite );
    ds >> vector;

    Q3ValueVector<int>::size_type cap = vector.capacity();

    // should do nothing
    if( cap > 5 )
	vector.reserve( vector.capacity() - 5 );
    else
	vector.reserve( 0 );

    QVERIFY( vector.capacity() == cap );

    // should make capacity() grow
    vector.reserve( vector.capacity() + 5 );
    QVERIFY( cap < vector.capacity() );
}