summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/text/qbytearrayapisymmetry
diff options
context:
space:
mode:
authorSona Kurazyan <sona.kurazyan@qt.io>2020-07-09 18:16:13 +0200
committerSona Kurazyan <sona.kurazyan@qt.io>2020-07-09 18:38:33 +0200
commit577558daf5a2709722cb7980f194cbbc6a8287a3 (patch)
treec46e04ac0c6439ce9eb533146cc7feb37a949a0d /tests/auto/corelib/text/qbytearrayapisymmetry
parentc023b025ee7f3e221b1ad947722ec4d4fa5f5e5e (diff)
Fix QByteArray::count implementation for longer data
The issue has been introduced when refactoring QByteArray::count implementation (see 631127126cc14e7c01cc611532b3256b58785670). Because the last argument of QByteArrayMatcher::indexIn() method has a defult value, it has been compiling without issues, but was being called with incorrect size parameter. Fixed it to pass the length of the input data correctly. Change-Id: Ic9c2f33733131ec17276aa889f2d7ea40ec79b01 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'tests/auto/corelib/text/qbytearrayapisymmetry')
-rw-r--r--tests/auto/corelib/text/qbytearrayapisymmetry/tst_qbytearrayapisymmetry.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/auto/corelib/text/qbytearrayapisymmetry/tst_qbytearrayapisymmetry.cpp b/tests/auto/corelib/text/qbytearrayapisymmetry/tst_qbytearrayapisymmetry.cpp
index 33fd25cb50..8b51727417 100644
--- a/tests/auto/corelib/text/qbytearrayapisymmetry/tst_qbytearrayapisymmetry.cpp
+++ b/tests/auto/corelib/text/qbytearrayapisymmetry/tst_qbytearrayapisymmetry.cpp
@@ -490,6 +490,13 @@ void tst_QByteArrayApiSymmetry::count_data()
QTest::addRow("aaa") << QByteArray("aaa") << QByteArray("a") << 3;
QTest::addRow("xyzaaaxyz") << QByteArray("xyzaaxyaxyz") << QByteArray("xyz") << 2;
+
+ const int len = 500;
+ QByteArray longData(len, 'a');
+ const QByteArray needle("abcdef");
+ longData.insert(0, needle);
+ longData.insert(len / 2, needle);
+ QTest::addRow("longInput") << longData << needle << 2;
}
template <typename Haystack, typename Needle>