tst_QStringApiSymmetry: use startpos to deduplicate indexing data tags

The tests for indexOf() and lastIndexOf() had duplicate data row tags,
due to only using the needle and haystack, although some tests
differed only in start position. Include start position where needed.

Change-Id: I197d415265ab1a805f2d36fb88aec92ea8646f7a
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
This commit is contained in:
Edward Welbourne 2022-10-05 13:58:33 +02:00
parent 5b70546c17
commit 8bb0d2308e

View File

@ -2943,9 +2943,9 @@ void tst_QStringApiSymmetry::indexOf_data(bool rhsHasVariableLength)
<< minus1Pos << minus1Pos;
#define ROW(h, n, st, cs, cis) \
QTest::addRow("haystack: %s, needle: %s", #h, #n) << h << QLatin1String(#h) \
<< n << QLatin1String(#n) \
<< qsizetype(st) << qsizetype(cs) << qsizetype(cis)
QTest::addRow("haystack: %s, needle: %s, start: %d", #h, #n, st) \
<< h << QLatin1String(#h) << n << QLatin1String(#n) \
<< qsizetype(st) << qsizetype(cs) << qsizetype(cis)
ROW(abc, a, 0, 0, 0);
ROW(abc, A, 0, -1, 0);
@ -3114,14 +3114,18 @@ void tst_QStringApiSymmetry::lastIndexOf_data(bool rhsHasVariableLength)
<< a << QLatin1String("a") << minus1Pos << minus1Pos << minus1Pos;
if (rhsHasVariableLength) {
QTest::addRow("haystack: a, needle: null") << a << QLatin1String("a")
<< null << QLatin1String() << qsizetype(1) << qsizetype(1) << qsizetype(1);
QTest::addRow("haystack: a, needle: empty") << a << QLatin1String("a")
<< empty << QLatin1String("") << qsizetype(1) << qsizetype(1) << qsizetype(1);
QTest::addRow("haystack: a, needle: null") << a << QLatin1String("a")
<< null << QLatin1String() << qsizetype(2) << minus1Pos << minus1Pos;
QTest::addRow("haystack: a, needle: empty") << a << QLatin1String("a")
<< empty << QLatin1String("") << qsizetype(2) << minus1Pos << minus1Pos;
QTest::addRow("haystack: a, needle: null, start 1")
<< a << QLatin1String("a")
<< null << QLatin1String() << qsizetype(1) << qsizetype(1) << qsizetype(1);
QTest::addRow("haystack: a, needle: empty, start 1")
<< a << QLatin1String("a")
<< empty << QLatin1String("") << qsizetype(1) << qsizetype(1) << qsizetype(1);
QTest::addRow("haystack: a, needle: null, start 2")
<< a << QLatin1String("a")
<< null << QLatin1String() << qsizetype(2) << minus1Pos << minus1Pos;
QTest::addRow("haystack: a, needle: empty, start 2")
<< a << QLatin1String("a")
<< empty << QLatin1String("") << qsizetype(2) << minus1Pos << minus1Pos;
}
#define ROW(h, n, st, cs, cis) \