diff options
author | Olivier Goffart <ogoffart@trolltech.com> | 2010-03-29 08:34:23 (GMT) |
---|---|---|
committer | Olivier Goffart <ogoffart@trolltech.com> | 2010-03-29 12:05:16 (GMT) |
commit | 809583a34cb69367ecb4218f798a5928de9aacec (patch) | |
tree | 83c8e127b069957f17d9b1684956b5d684895bae /tests/auto/qvarlengtharray/tst_qvarlengtharray.cpp | |
parent | 62b082833d904688e44e1bac4849bfa54bf5fe82 (diff) | |
download | Qt-809583a34cb69367ecb4218f798a5928de9aacec.zip Qt-809583a34cb69367ecb4218f798a5928de9aacec.tar.gz Qt-809583a34cb69367ecb4218f798a5928de9aacec.tar.bz2 |
QVarLenghtArray: add some API to be consistant to QVector
That way it is easier to have QVarLenghtArray as a drop-in replacement for QVector
Reviewed-by: Joao
Diffstat (limited to 'tests/auto/qvarlengtharray/tst_qvarlengtharray.cpp')
-rw-r--r-- | tests/auto/qvarlengtharray/tst_qvarlengtharray.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/auto/qvarlengtharray/tst_qvarlengtharray.cpp b/tests/auto/qvarlengtharray/tst_qvarlengtharray.cpp index 1c43069..5708726 100644 --- a/tests/auto/qvarlengtharray/tst_qvarlengtharray.cpp +++ b/tests/auto/qvarlengtharray/tst_qvarlengtharray.cpp @@ -133,6 +133,12 @@ void tst_QVarLengthArray::oldTests() QVERIFY(sa.data() == &sa[0]); QVERIFY(sa[0] == 0xfee); QVERIFY(sa[10] == 0xff); + QVERIFY(sa.at(0) == 0xfee); + QVERIFY(sa.at(10) == 0xff); + QVERIFY(sa.value(0) == 0xfee); + QVERIFY(sa.value(10) == 0xff); + QVERIFY(sa.value(1000) == 0); + QVERIFY(sa.value(1000, 12) == 12); QVERIFY(sa.size() == 512); sa.reserve(1024); QVERIFY(sa.capacity() == 1024); @@ -168,6 +174,13 @@ void tst_QVarLengthArray::oldTests() QCOMPARE(sa.size(), 12); QCOMPARE(sa[10], QString("hello")); QCOMPARE(sa[11], QString("world")); + QCOMPARE(sa.at(10), QString("hello")); + QCOMPARE(sa.at(11), QString("world")); + QCOMPARE(sa.value(10), QString("hello")); + QCOMPARE(sa.value(11), QString("world")); + QCOMPARE(sa.value(10000), QString()); + QCOMPARE(sa.value(1212112, QString("none")), QString("none")); + QCOMPARE(sa.value(-12, QString("neg")), QString("neg")); sa.append(arr, 1); QCOMPARE(sa.size(), 13); |