tst_QSctpSocket: replace QList with const array

"Never use a dynamically-sized container for statically-sized data."

Port the loop from Q_FOREACH (which can't deal with arrays) to ranged
for (which can).

Pick-to: 6.6 6.5
Task-number: QTBUG-115839
Change-Id: Iecfc037c8bbfc0b3196ed0c65f680768a8d2353a
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
This commit is contained in:
Marc Mutz 2023-08-08 07:37:03 +02:00
parent a4d968adc0
commit 3b6ae86ce8

View File

@ -127,12 +127,13 @@ void tst_QSctpSocket::bind_data()
// these ranges are guaranteed to be reserved for 'documentation purposes',
// and thus, should be unused in the real world. Not that I'm assuming the
// world is full of competent administrators, or anything.
QStringList knownBad;
knownBad << "198.51.100.1";
knownBad << "2001:0DB8::1";
foreach (const QString &badAddress, knownBad) {
const QString knownBad[] = {
"198.51.100.1",
"2001:0DB8::1",
};
for (const QString &badAddress : knownBad)
QTest::newRow(badAddress.toLatin1().constData()) << badAddress << false << QString();
}
}
// Testing bind function