summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/tools/qalgorithms
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@kdab.com>2017-01-05 15:43:21 +0100
committerMarc Mutz <marc.mutz@kdab.com>2017-01-10 07:47:26 +0000
commitb2173b54ef9ede85d88cb0fdf025b26e732ed44a (patch)
tree924daecbd0281944634838e2b19c6296c8fffd3d /tests/auto/corelib/tools/qalgorithms
parentd135acfa43810b2f7a2dba12688bbaa07a2e08cc (diff)
Long live QTest::addRow()!
This new function does the same as newRow(), except that it has a less confusing name (in line with _add_Column()), and accepts printf-style arguments to avoid the need to newRow(qPrintable(QString::asprintf())), a common pattern in client code. It uses qvsnprintf() under the hoods, avoiding the need for the QString const char* round-trip. Port all in-tree users of newRow(qPrintable(QString::asnprintf())) to the new function. Change-Id: Icd5de9b7ea4f6759d98080ec30f5aecadb8bec39 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'tests/auto/corelib/tools/qalgorithms')
-rw-r--r--tests/auto/corelib/tools/qalgorithms/tst_qalgorithms.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/tests/auto/corelib/tools/qalgorithms/tst_qalgorithms.cpp b/tests/auto/corelib/tools/qalgorithms/tst_qalgorithms.cpp
index c14e9fadf7..e13c2894af 100644
--- a/tests/auto/corelib/tools/qalgorithms/tst_qalgorithms.cpp
+++ b/tests/auto/corelib/tools/qalgorithms/tst_qalgorithms.cpp
@@ -1076,22 +1076,22 @@ void tst_QAlgorithms::popCount_data_impl(size_t sizeof_T_Int)
const uint bits = bitsSetInByte(byte);
const quint64 value = static_cast<quint64>(byte);
const quint64 input = value << ((i % sizeof_T_Int) * 8U);
- newRow(qPrintable(QString::asprintf("0x%016llx", input))) << input << bits;
+ QTest::addRow("0x%016llx", input) << input << bits;
}
// and some random ones:
if (sizeof_T_Int >= 8)
for (size_t i = 0; i < 1000; ++i) {
const quint64 input = quint64(qrand()) << 32 | quint32(qrand());
- newRow(qPrintable(QString::asprintf("0x%016llx", input))) << input << bitsSetInInt64(input);
+ QTest::addRow("0x%016llx", input) << input << bitsSetInInt64(input);
}
else if (sizeof_T_Int >= 2)
for (size_t i = 0; i < 1000 ; ++i) {
const quint32 input = qrand();
if (sizeof_T_Int >= 4)
- newRow(qPrintable(QString::asprintf("0x%08x", input))) << quint64(input) << bitsSetInInt(input);
+ QTest::addRow("0x%08x", input) << quint64(input) << bitsSetInInt(input);
else
- newRow(qPrintable(QString::asprintf("0x%04x", quint16(input & 0xFFFF)))) << quint64(input & 0xFFFF) << bitsSetInShort(input & 0xFFFF);
+ QTest::addRow("0x%04x", quint16(input & 0xFFFF)) << quint64(input & 0xFFFF) << bitsSetInShort(input & 0xFFFF);
}
}