68 if (receiveCount == neededReceiveCount) |
73 if (receiveCount == neededReceiveCount) |
69 QTestEventLoop::instance().exitLoop(); |
74 QTestEventLoop::instance().exitLoop(); |
70 } |
75 } |
71 }; |
76 }; |
72 |
77 |
|
78 void tst_qhostinfo::init() |
|
79 { |
|
80 // delete the cache so inidividual testcase results are independant from each other |
|
81 qt_qhostinfo_clear_cache(); |
|
82 } |
|
83 |
|
84 void tst_qhostinfo::lookupSpeed_data() |
|
85 { |
|
86 QTest::addColumn<bool>("cache"); |
|
87 QTest::newRow("WithCache") << true; |
|
88 QTest::newRow("WithoutCache") << false; |
|
89 } |
|
90 |
73 void tst_qhostinfo::lookupSpeed() |
91 void tst_qhostinfo::lookupSpeed() |
74 { |
92 { |
|
93 QFETCH(bool, cache); |
|
94 qt_qhostinfo_enable_cache(cache); |
|
95 |
75 QStringList hostnameList; |
96 QStringList hostnameList; |
76 hostnameList << "www.ovi.com" << "www.nokia.com" << "qt.nokia.com" << "www.trolltech.com" << "troll.no" |
97 hostnameList << "www.ovi.com" << "www.nokia.com" << "qt.nokia.com" << "www.trolltech.com" << "troll.no" |
77 << "www.qtcentre.org" << "forum.nokia.com" << "www.forum.nokia.com" << "wiki.forum.nokia.com" |
98 << "www.qtcentre.org" << "forum.nokia.com" << "www.forum.nokia.com" << "wiki.forum.nokia.com" |
78 << "www.nokia.no" << "nokia.de" << "127.0.0.1" << "----"; |
99 << "www.nokia.no" << "nokia.de" << "127.0.0.1" << "----"; |
79 // also add some duplicates: |
100 // also add some duplicates: |
80 hostnameList << "www.nokia.com" << "127.0.0.1" << "www.trolltech.com"; |
101 hostnameList << "www.nokia.com" << "127.0.0.1" << "www.trolltech.com"; |
|
102 // and some more |
|
103 hostnameList << hostnameList; |
|
104 |
81 const int COUNT = hostnameList.size(); |
105 const int COUNT = hostnameList.size(); |
82 |
106 |
83 SignalReceiver receiver(COUNT); |
107 SignalReceiver receiver(COUNT); |
84 |
108 |
85 QBENCHMARK { |
109 QBENCHMARK { |