Remove bad test in QVector

This test hardcodes the allocation behaviour instead of testing what
it should be testing. Unfortunately, it can't test the actual problem
directly since the problem was "it crashed when using vectors with 1
billion elements".

Change-Id: Iec6a26ae490b8fdd4a7db1269e3bae85fc77ee52
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
bb10
Thiago Macieira 2012-06-23 10:09:09 +02:00 committed by Lars Knoll
parent add048bc4e
commit 443aaa6dec
1 changed files with 0 additions and 83 deletions

View File

@ -307,8 +307,6 @@ private slots:
void reserve();
void reserveZero();
void reallocAfterCopy_data();
void reallocAfterCopy();
void initializeListInt();
void initializeListMovable();
void initializeListCustom();
@ -2341,87 +2339,6 @@ void tst_QVector::reserveZero()
QVERIFY(vec.capacity() >= 1);
}
// This is a regression test for QTBUG-11763, where memory would be reallocated
// soon after copying a QVector.
void tst_QVector::reallocAfterCopy_data()
{
QTest::addColumn<int>("capacity");
QTest::addColumn<int>("fill_size");
QTest::addColumn<int>("func_id");
QTest::addColumn<int>("result1");
QTest::addColumn<int>("result2");
QTest::addColumn<int>("result3");
QTest::addColumn<int>("result4");
int result1, result2, result3, result4;
int fill_size;
for (int i = 70; i <= 100; i += 10) {
const QByteArray prefix = "reallocAfterCopy:" + QByteArray::number(i) + ',';
fill_size = i - 20;
for (int j = 0; j <= 3; j++) {
if (j == 0) { // append
result1 = i;
result2 = i;
result3 = i - 19;
result4 = i - 20;
} else if (j == 1) { // insert(0)
result1 = i;
result2 = i;
result3 = i - 19;
result4 = i - 20;
} else if (j == 2) { // insert(20)
result1 = i;
result2 = i;
result3 = i - 19;
result4 = i - 20;
} else if (j == 3) { // insert(0, 10)
result1 = i;
result2 = i;
result3 = i - 10;
result4 = i - 20;
}
QTest::newRow((prefix + QByteArray::number(j)).constData())
<< i << fill_size << j << result1 << result2 << result3 << result4;
}
}
}
void tst_QVector::reallocAfterCopy()
{
QFETCH(int, capacity);
QFETCH(int, fill_size);
QFETCH(int, func_id);
QFETCH(int, result1);
QFETCH(int, result2);
QFETCH(int, result3);
QFETCH(int, result4);
QVector<qreal> v1;
QVector<qreal> v2;
v1.reserve(capacity);
v1.resize(0);
v1.fill(qreal(1.0), fill_size);
v2 = v1;
// no need to test begin() and end(), there is a detach() in them
if (func_id == 0) {
v1.append(qreal(1.0)); //push_back is same as append
} else if (func_id == 1) {
v1.insert(0, qreal(1.0)); //push_front is same as prepend, insert(0)
} else if (func_id == 2) {
v1.insert(20, qreal(1.0));
} else if (func_id == 3) {
v1.insert(0, 10, qreal(1.0));
}
QCOMPARE(v1.capacity(), result1);
QCOMPARE(v2.capacity(), result2);
QCOMPARE(v1.size(), result3);
QCOMPARE(v2.size(), result4);
}
template<typename T>
void tst_QVector::initializeList()
{