From 8bb0d2308e62d23b612e7e050c72041729182eae Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Wed, 5 Oct 2022 13:58:33 +0200 Subject: [PATCH] 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 --- .../tst_qstringapisymmetry.cpp | 26 +++++++++++-------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/tests/auto/corelib/text/qstringapisymmetry/tst_qstringapisymmetry.cpp b/tests/auto/corelib/text/qstringapisymmetry/tst_qstringapisymmetry.cpp index 235a1493dc..0360a61832 100644 --- a/tests/auto/corelib/text/qstringapisymmetry/tst_qstringapisymmetry.cpp +++ b/tests/auto/corelib/text/qstringapisymmetry/tst_qstringapisymmetry.cpp @@ -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) \