File indexing completed on 2024-09-29 03:40:34
0001 /* 0002 SPDX-FileCopyrightText: 2012-2013 Jan Grulich <jgrulich@redhat.com> 0003 0004 SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL 0005 */ 0006 0007 #include "infinibandsettingtest.h" 0008 0009 #include "settings/infinibandsetting.h" 0010 0011 #include <libnm/NetworkManager.h> 0012 0013 #include <QTest> 0014 0015 void InfinibandSettingTest::testSetting_data() 0016 { 0017 QTest::addColumn<QByteArray>("macAddress"); 0018 QTest::addColumn<quint32>("mtu"); 0019 QTest::addColumn<QString>("transportMode"); 0020 0021 QTest::newRow("setting1") << QByteArray("eth0") // macAddress 0022 << (quint32)1000 // mtu 0023 << "connected"; // transportMode 0024 } 0025 0026 void InfinibandSettingTest::testSetting() 0027 { 0028 QFETCH(QByteArray, macAddress); 0029 QFETCH(quint32, mtu); 0030 QFETCH(QString, transportMode); 0031 0032 QVariantMap map; 0033 0034 map.insert(QLatin1String(NM_SETTING_INFINIBAND_MAC_ADDRESS), macAddress); 0035 map.insert(QLatin1String(NM_SETTING_INFINIBAND_MTU), mtu); 0036 map.insert(QLatin1String(NM_SETTING_INFINIBAND_TRANSPORT_MODE), transportMode); 0037 0038 NetworkManager::InfinibandSetting setting; 0039 setting.fromMap(map); 0040 0041 QVariantMap map1 = setting.toMap(); 0042 QVariantMap::const_iterator it = map.constBegin(); 0043 while (it != map.constEnd()) { 0044 QCOMPARE(it.value(), map1.value(it.key())); 0045 ++it; 0046 } 0047 } 0048 0049 QTEST_MAIN(InfinibandSettingTest) 0050 0051 #include "moc_infinibandsettingtest.cpp"