diff options
Diffstat (limited to 'tests/auto/network/kernel/qnetworkinterface/tst_qnetworkinterface.cpp')
-rw-r--r-- | tests/auto/network/kernel/qnetworkinterface/tst_qnetworkinterface.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/auto/network/kernel/qnetworkinterface/tst_qnetworkinterface.cpp b/tests/auto/network/kernel/qnetworkinterface/tst_qnetworkinterface.cpp index 2a0552b770..cc3b99ff76 100644 --- a/tests/auto/network/kernel/qnetworkinterface/tst_qnetworkinterface.cpp +++ b/tests/auto/network/kernel/qnetworkinterface/tst_qnetworkinterface.cpp @@ -55,6 +55,7 @@ private slots: void initTestCase(); void cleanupTestCase(); void dump(); + void consistencyCheck(); void loopbackIPv4(); void loopbackIPv6(); void localAddress(); @@ -148,6 +149,24 @@ void tst_QNetworkInterface::dump() } } +void tst_QNetworkInterface::consistencyCheck() +{ + QList<QNetworkInterface> ifaces = QNetworkInterface::allInterfaces(); + QSet<QString> interfaceNames; + QVector<int> interfaceIndexes; + + foreach (const QNetworkInterface &iface, ifaces) { + QVERIFY2(!interfaceNames.contains(iface.name()), + "duplicate name = " + iface.name().toLocal8Bit()); + interfaceNames << iface.name(); + + QVERIFY2(!interfaceIndexes.contains(iface.index()), + "duplicate index = " + QByteArray::number(iface.index())); + if (iface.index()) + interfaceIndexes << iface.index(); + } +} + void tst_QNetworkInterface::loopbackIPv4() { QList<QHostAddress> all = QNetworkInterface::allAddresses(); |