Example #1
0
void tst_Q3ValueList::fromLast()
{
    Q3ValueList<int> a;
    Q3ValueListIterator<int> it = a.fromLast();
    QVERIFY( (it == a.end()) );

    a.append( 1 );
    a.append( 10 );
    a.append( 100 );
    it = a.fromLast();
    QVERIFY( (it != a.end()) );

    QCOMPARE( a.last(), 100 );
    *(a.fromLast()) = 200;
    QCOMPARE( a.last(), 200 );
}
Example #2
0
void tst_Q3ValueList::insert()
{
    Q3ValueList<int> a;
    a.append( 1 );
    a.append( 10 );
    a.append( 100 );

    Q3ValueListIterator<int> it = a.fromLast();
    it = a.insert( it, 1000 );

    QCOMPARE( *(it), 1000 );
    QCOMPARE( *(++it), 100 );
    QCOMPARE( (int)a.count(), 4 );

    it = a.fromLast();
    a.insert( it, 10, 1234 );
    QCOMPARE( (int)a.count(), 14 );
}