mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-22 14:55:36 +08:00
refs #369, fixed / adjusted testing and samples
* changed from qDebug() to QTextStream * setter for voice room * set fake voice room URL, otherwise no nonger displayed in GUI
This commit is contained in:
@@ -56,7 +56,7 @@ int main(int argc, char *argv[])
|
||||
else if (s.startsWith("3")) { CSamplesContainer::samples(); }
|
||||
else if (s.startsWith("4")) { CSamplesMetadata::samples(); }
|
||||
else if (s.startsWith("5")) { CSamplesVariant::samples(); }
|
||||
else if (s.startsWith("6")) { CSamplesPerformance::samples(); }
|
||||
else if (s.startsWith("6")) { CSamplesPerformance::samples(qtout); }
|
||||
else if (s.startsWith("7")) { CSamplesAlgorithm::samples(); }
|
||||
else if (s.startsWith("8")) { CSamplesConcurrent::samples(s, qtout, qtin); }
|
||||
else if (s.startsWith("x")) { break; }
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace BlackMiscTest
|
||||
/*
|
||||
* Samples
|
||||
*/
|
||||
int CSamplesPerformance::samples()
|
||||
int CSamplesPerformance::samples(QTextStream &out)
|
||||
{
|
||||
QTime timer;
|
||||
int ms, number;
|
||||
@@ -28,88 +28,88 @@ namespace BlackMiscTest
|
||||
timer.start();
|
||||
CAtcStationList atcs1 = BlackMisc::Aviation::CTesting::createAtcStations(10000);
|
||||
ms = timer.elapsed();
|
||||
qDebug() << "created (copy)" << atcs1.size() << "ATC stations in" << ms << "ms";
|
||||
out << "created (copy) " << atcs1.size() << " ATC stations in " << ms << "ms" << endl;
|
||||
|
||||
timer.start();
|
||||
CAtcStationList atcs2 = BlackMisc::Aviation::CTesting::createAtcStations(100000);
|
||||
ms = timer.elapsed();
|
||||
qDebug() << "created (copy)" << atcs2.size() << "ATC stations in" << ms << "ms";
|
||||
out << "created (copy) " << atcs2.size() << " ATC stations in " << ms << "ms" << endl;
|
||||
|
||||
// ATC stations, property index created
|
||||
timer.start();
|
||||
CAtcStationList atcs3 = BlackMisc::Aviation::CTesting::createAtcStations(10000, true);
|
||||
ms = timer.elapsed();
|
||||
qDebug() << "created (propertyIndex)" << atcs3.size() << "ATC stations in" << ms << "ms";
|
||||
out << "created (propertyIndex) " << atcs3.size() << " ATC stations in " << ms << "ms" << endl;
|
||||
|
||||
timer.start();
|
||||
CAtcStationList atcs4 = BlackMisc::Aviation::CTesting::createAtcStations(100000, true);
|
||||
ms = timer.elapsed();
|
||||
qDebug() << "created (propertyIndex)" << atcs4.size() << "ATC stations in" << ms << "ms";
|
||||
out << "created (propertyIndex) " << atcs4.size() << " ATC stations in " << ms << "ms" << endl;
|
||||
|
||||
// Sort by
|
||||
timer.start();
|
||||
atcs1.sortBy(&CAtcStation::getCallsign);
|
||||
ms = timer.elapsed();
|
||||
qDebug() << "Sorted by callsign" << atcs1.size() << "ATC stations in" << ms << "ms";
|
||||
out << "Sorted by callsign " << atcs1.size() << " ATC stations in " << ms << "ms" << endl;
|
||||
|
||||
timer.start();
|
||||
atcs2.sortBy(&CAtcStation::getCallsign);
|
||||
ms = timer.elapsed();
|
||||
qDebug() << "Sorted by callsign" << atcs2.size() << "ATC stations in" << ms << "ms";
|
||||
out << "Sorted by callsign " << atcs2.size() << " ATC stations in " << ms << "ms" << endl;
|
||||
|
||||
// Read data, this is what all our models do when displaying in a table view
|
||||
timer.start();
|
||||
BlackMisc::Aviation::CTesting::readStations(atcs1, false);
|
||||
ms = timer.elapsed();
|
||||
qDebug() << "Read (getters)" << atcs1.size() << "ATC stations in" << ms << "ms";
|
||||
out << "Read (getters) " << atcs1.size() << " ATC stations in " << ms << "ms" << endl;
|
||||
|
||||
timer.start();
|
||||
BlackMisc::Aviation::CTesting::readStations(atcs2, false);
|
||||
ms = timer.elapsed();
|
||||
qDebug() << "Read (getters)" << atcs2.size() << "ATC stations in" << ms << "ms";
|
||||
out << "Read (getters) " << atcs2.size() << " ATC stations in " << ms << "ms" << endl;
|
||||
|
||||
timer.start();
|
||||
BlackMisc::Aviation::CTesting::readStations(atcs1, true);
|
||||
ms = timer.elapsed();
|
||||
qDebug() << "Read (propertyIndex)" << atcs1.size() << "ATC stations in" << ms << "ms";
|
||||
out << "Read (propertyIndex) " << atcs1.size() << " ATC stations in " << ms << "ms" << endl;
|
||||
|
||||
timer.start();
|
||||
BlackMisc::Aviation::CTesting::readStations(atcs2, true);
|
||||
ms = timer.elapsed();
|
||||
qDebug() << "Read (propertyIndex)" << atcs2.size() << "ATC stations in" << ms << "ms";
|
||||
out << "Read (propertyIndex) " << atcs2.size() << " ATC stations in " << ms << "ms" << endl;
|
||||
|
||||
// calculate
|
||||
number = 10000;
|
||||
timer.start();
|
||||
BlackMisc::Aviation::CTesting::calculateDistance(number);
|
||||
ms = timer.elapsed();
|
||||
qDebug() << "Calculated distances " << number << "in" << ms << "ms";
|
||||
out << "Calculated distances " << number << " in " << ms << "ms" << endl;
|
||||
|
||||
number = 100000;
|
||||
timer.start();
|
||||
BlackMisc::Aviation::CTesting::calculateDistance(number);
|
||||
ms = timer.elapsed();
|
||||
qDebug() << "Calculated distances " << number << "in" << ms << "ms";
|
||||
out << "Calculated distances " << number << "in " << ms << "ms" << endl;
|
||||
|
||||
// parse
|
||||
number = 100000;
|
||||
timer.start();
|
||||
BlackMisc::Aviation::CTesting::parseWgs(number);
|
||||
ms = timer.elapsed();
|
||||
qDebug() << "Parse WGS coordinates" << number << "in" << ms << "ms";
|
||||
out << "Parse WGS coordinates " << number << " in " << ms << "ms" << endl;
|
||||
|
||||
// copy
|
||||
timer.start();
|
||||
number = 20;
|
||||
BlackMisc::Aviation::CTesting::copy10kStations(number);
|
||||
ms = timer.elapsed();
|
||||
qDebug() << "Copied 10k stations" << number << "times in" << ms << "ms";
|
||||
out << "Copied 10k stations " << number << " times in " << ms << "ms" << endl;
|
||||
|
||||
timer.start();
|
||||
number = 100;
|
||||
BlackMisc::Aviation::CTesting::copy10kStations(number);
|
||||
ms = timer.elapsed();
|
||||
qDebug() << "Copied 10k stations" << number << "times in" << ms << "ms";
|
||||
out << "Copied 10k stations " << number << " times in " << ms << "ms" << endl;
|
||||
|
||||
// Regex pattern matching with lists of 10000 strings containing random hex numbers
|
||||
auto generator = []() { return QString::number(qrand() | (qrand() << 16), 16); };
|
||||
@@ -126,24 +126,24 @@ namespace BlackMiscTest
|
||||
timer.start();
|
||||
for (const auto &str : strList1) { if (newRegex.match(str).hasMatch()) number++; }
|
||||
ms = timer.elapsed();
|
||||
qDebug() << "new regex matched" << number << "of" << strList1.size() << "strings in" << ms << "ms";
|
||||
out << "new regex matched " << number << " of" << strList1.size() << " strings in " << ms << "ms" << endl;
|
||||
number = 0;
|
||||
timer.start();
|
||||
for (const auto &str : strList2) { if (fullRegex.exactMatch(str)) number++; }
|
||||
ms = timer.elapsed();
|
||||
qDebug() << "full regex matched" << number << "of" << strList2.size() << "strings in" << ms << "ms";
|
||||
out << "full regex matched " << number << " of" << strList2.size() << " strings in " << ms << "ms" << endl;
|
||||
number = 0;
|
||||
timer.start();
|
||||
for (const auto &str : strList3) { if (wildcardRegex.exactMatch(str)) number++; }
|
||||
ms = timer.elapsed();
|
||||
qDebug() << "wildcard matched" << number << "of" << strList3.size() << "strings in" << ms << "ms";
|
||||
out << "wildcard matched " << number << " of " << strList3.size() << " strings in " << ms << "ms" << endl;
|
||||
number = 0;
|
||||
timer.start();
|
||||
for (const auto &str : strList4) { if (str.contains(containsStr)) number++; }
|
||||
ms = timer.elapsed();
|
||||
qDebug() << "contains matched" << number << "of" << strList4.size() << "strings in" << ms << "ms";
|
||||
out << "contains matched " << number << " of " << strList4.size() << " strings in " << ms << "ms" << endl;
|
||||
|
||||
qDebug() << "-----------------------------------------------";
|
||||
out << "-----------------------------------------------" << endl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -12,6 +12,8 @@
|
||||
#ifndef BLACKMISCTEST_SAMPLESPERFORMANCEINDEX_H
|
||||
#define BLACKMISCTEST_SAMPLESPERFORMANCEINDEX_H
|
||||
|
||||
#include <QTextStream>
|
||||
|
||||
namespace BlackMiscTest
|
||||
{
|
||||
//! Samples for our containers
|
||||
@@ -19,7 +21,7 @@ namespace BlackMiscTest
|
||||
{
|
||||
public:
|
||||
//! Run the samples
|
||||
static int samples();
|
||||
static int samples(QTextStream &out);
|
||||
};
|
||||
} // namespace
|
||||
|
||||
|
||||
Reference in New Issue
Block a user