summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Strømme <christian.stromme@digia.com>2012-10-10 15:04:42 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2012-11-07 14:19:00 +0100
commit9d0afa2ab02ddd86818e83d514e03f6dfb5a1fef (patch)
tree69e27fba9ceec8c76154633f8e52a201d9ab3faf
parent5b52cb5b85e90d511a339c2775d2006493a82371 (diff)
Remove out-of-memory test in QVarLengthArray.
No reason to keep this test. If an application is trying to allocate too much memory it will fail, and its the users responsibility to provide sane values and catch exceptions to recover. Task-number: QTBUG-27361 Change-Id: I29d71745ab791b6e8a76f7b1f866ff4bd7024749 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
-rw-r--r--tests/auto/corelib/tools/qvarlengtharray/tst_qvarlengtharray.cpp50
1 files changed, 0 insertions, 50 deletions
diff --git a/tests/auto/corelib/tools/qvarlengtharray/tst_qvarlengtharray.cpp b/tests/auto/corelib/tools/qvarlengtharray/tst_qvarlengtharray.cpp
index 21e8c36081..3722420663 100644
--- a/tests/auto/corelib/tools/qvarlengtharray/tst_qvarlengtharray.cpp
+++ b/tests/auto/corelib/tools/qvarlengtharray/tst_qvarlengtharray.cpp
@@ -58,7 +58,6 @@ private slots:
void count();
void first();
void last();
- void outOfMemory();
};
int fooCtor = 0;
@@ -201,55 +200,6 @@ void tst_QVarLengthArray::oldTests()
}
}
-void tst_QVarLengthArray::outOfMemory()
-{
- QSKIP("QTBUG-27361");
- QVarLengthArray<Foo> a;
- const int N = 0x7fffffff / sizeof(Foo);
- const int Prealloc = a.capacity();
- const Foo *data0 = a.constData();
-
- a.resize(N);
- if (a.size() == N) {
- QVERIFY(a.capacity() >= N);
- QCOMPARE(fooCtor, N);
- QCOMPARE(fooDtor, 0);
-
- for (int i = 0; i < N; i += 35000)
- a[i] = Foo();
- } else {
- // this is the case we're actually testing
- QCOMPARE(a.size(), 0);
- QCOMPARE(a.capacity(), Prealloc);
- QCOMPARE(a.constData(), data0);
- QCOMPARE(fooCtor, 0);
- QCOMPARE(fooDtor, 0);
-
- a.resize(5);
- QCOMPARE(a.size(), 5);
- QCOMPARE(a.capacity(), Prealloc);
- QCOMPARE(a.constData(), data0);
- QCOMPARE(fooCtor, 5);
- QCOMPARE(fooDtor, 0);
-
- a.resize(Prealloc + 1);
- QCOMPARE(a.size(), Prealloc + 1);
- QVERIFY(a.capacity() >= Prealloc + 1);
- QVERIFY(a.constData() != data0);
- QCOMPARE(fooCtor, Prealloc + 6);
- QCOMPARE(fooDtor, 5);
-
- const Foo *data1 = a.constData();
-
- a.resize(0x10000000);
- QCOMPARE(a.size(), 0);
- QVERIFY(a.capacity() >= Prealloc + 1);
- QVERIFY(a.constData() == data1);
- QCOMPARE(fooCtor, Prealloc + 6);
- QCOMPARE(fooDtor, Prealloc + 6);
- }
-}
-
void tst_QVarLengthArray::appendCausingRealloc()
{
// This is a regression test for an old bug where creating a