samples and tests for all kbatclist branch changes

refs #81
This commit is contained in:
Klaus Basan
2014-01-02 02:22:13 +00:00
committed by Mathew Sutcliffe
parent 1f2a88e502
commit ab17dabd5b
58 changed files with 6084 additions and 880 deletions

View File

@@ -1,6 +1,6 @@
include (../../externals.pri)
QT += core testlib dbus
QT += core testlib dbus network
TARGET = test_blackcore
TEMPLATE = app

View File

@@ -6,7 +6,6 @@
#include "testblackcoremain.h"
#include "testinterpolator.h"
#include "testnetwork.h"
#include "testnetmediators.h"
namespace BlackCoreTest
{
@@ -25,10 +24,6 @@ int CBlackCoreTestMain::unitMain(int argc, char *argv[])
CTestNetwork networkTests;
status |= QTest::qExec(&networkTests, argc, argv);
}
{
CTestNetMediators mediatorTests;
status |= QTest::qExec(&mediatorTests, argc, argv);
}
return status;
}
} // namespace

View File

@@ -6,6 +6,7 @@
#ifndef BLACKCORETEST_TESTMAIN_H
#define BLACKCORETEST_TESTMAIN_H
#include "blackmisc/valueobject.h" // for qHash overload, include before Qt stuff due GCC issue
#include <QtTest/QtTest>
namespace BlackCoreTest

View File

@@ -8,29 +8,30 @@
using namespace BlackCore;
using namespace BlackMisc;
using namespace BlackMisc::Aviation;
using namespace BlackMisc::Network;
using namespace BlackMisc::Geo;
using namespace BlackMisc::PhysicalQuantities;
void BlackCoreTest::CTestNetwork::networkTest(BlackCore::INetwork* net)
void BlackCoreTest::CTestNetwork::networkTest(BlackCore::INetwork *net)
{
Expect e(net);
QString callsign = "TEST01";
EXPECT_UNIT(e)
.send(&INetwork::setServerDetails, "vatsim-germany.org", 6809)
.send(&INetwork::setUserCredentials, "guest", "guest")
.send(&INetwork::setRealName, "Pilot Client Tester")
.send(&INetwork::setCallsign, callsign)
.send(&INetwork::setServer, CServer("", "", "vatsim-germany.org", 6809, CUser("guest", "", "", "guest")))
.send(&INetwork::setCallsign, "BLACK")
.send(&INetwork::initiateConnection)
.expect(&INetwork::connectionStatusConnecting, []{ qDebug() << "CONNECTING"; })
.expect(&INetwork::connectionStatusConnected, []{ qDebug() << "CONNECTED"; })
.expect(&INetwork::connectionStatusConnecting, [] { qDebug() << "CONNECTING"; })
.expect(&INetwork::connectionStatusConnected, [] { qDebug() << "CONNECTED"; })
.wait(10);
EXPECT_UNIT(e)
.send(&INetwork::ping, "server")
.expect(&INetwork::pong, [](QString s, PhysicalQuantities::CTime t){ qDebug() << "PONG" << s << t; })
.expect(&INetwork::pong, [](CCallsign callsign, PhysicalQuantities::CTime elapsedTime) { qDebug() << "PONG" << callsign << elapsedTime; })
.wait(10);
EXPECT_UNIT(e)
.send(&INetwork::terminateConnection)
.expect(&INetwork::connectionStatusDisconnected, []{ qDebug() << "DISCONNECTED"; })
.expect(&INetwork::connectionStatusDisconnected, [] { qDebug() << "DISCONNECTED"; })
.wait(10);
}
}