Fix doxygen documentation in src, samples and tests

refs #594
This commit is contained in:
Roland Winklmeier
2016-02-12 10:24:43 +01:00
parent bd6f0d0f25
commit 1ea2f34f75
77 changed files with 589 additions and 73 deletions

View File

@@ -238,7 +238,8 @@ TAB_SIZE = 4
# "Side Effects:". You can put \n's in the value part of an alias to insert
# newlines.
ALIASES = "threadsafe=@remarks This function is thread safe."
ALIASES = "threadsafe=@remarks This function is thread safe." \
"fixme=\todo"
# This tag can be used to specify a number of word-keyword mappings (TCL only).
# A mapping has the form "name=value". For example adding "class=itcl::class"

View File

@@ -21,7 +21,7 @@
using namespace BlackMisc;
using namespace BlackSample;
//! Sample tests
//! main
int main(int argc, char *argv[])
{
// I use QGuiApplication and not core application

View File

@@ -16,10 +16,7 @@
#include <QCoreApplication>
#include <QList>
/*!
* DBus tests, tests marshalling / unmarshalling of many value classes.
* Forks two processes and sends data via DBus among them.
*/
//! main
int main(int argc, char *argv[])
{
// of course the code here is containing too many lines, but as it

View File

@@ -72,6 +72,7 @@ namespace BlackSample
/*!
* \brief Display QDBusArgument
* \param arg
* \param level
*/
static void displayQDBusArgument(const QDBusArgument &arg, qint32 level = 0);

View File

@@ -30,7 +30,10 @@
#include <QDBusConnection>
#include <QDBusObjectPath>
//! DBus interface for test service
#define BLACKSAMPLE_TESTSERVICE_INTERFACENAME "blackmisctest.testservice"
//! DBus object path for test service
#define BLACKSAMPLE_TESTSERVICE_OBJECTPATH "/ts"
namespace BlackSample

View File

@@ -16,7 +16,7 @@
using namespace BlackMisc;
using namespace BlackSample;
//! Samples
//! main
int main(int argc, char *argv[])
{
QTextStream out(stdout, QIODevice::WriteOnly);

View File

@@ -18,9 +18,7 @@
#include <QDebug>
#include <QTime>
/*!
* Samples
*/
//! main
int main(int argc, char *argv[])
{
Q_UNUSED(argc);

View File

@@ -23,6 +23,13 @@
namespace BlackSample
{
/*!
* \brief Simple command line interface client
*
* This class implements a simple and limited command line interace class.
* It accepts commands from the console via \sa command. Note that the class
* does not send anything on its own, not even position packets.
*/
class Client :
public QObject,
public BlackMisc::Simulation::COwnAircraftAware,
@@ -31,6 +38,7 @@ namespace BlackSample
Q_OBJECT
public:
//! Constructor
Client(QObject *parent = nullptr);
signals:
@@ -72,6 +80,8 @@ namespace BlackSample
void sendCustomPacketCmd(QTextStream &args);
signals: //to send to INetwork
//! \name Signals to INetwork
//! @{
void presetServer(const BlackMisc::Network::CServer &server);
void presetCallsign(const BlackMisc::Aviation::CCallsign &callsign);
void presetRealName(const QString &name);
@@ -96,8 +106,11 @@ namespace BlackSample
void sendPing(const BlackMisc::Aviation::CCallsign &callsign);
void sendMetarQuery(const QString &airportICAO);
void sendCustomPacket(const BlackMisc::Aviation::CCallsign &callsign, const QString &packetId, const QStringList &data);
//! @}
public slots: //to receive from INetwork
public slots:
//! \name Slots connected to INetwork
//! @{
void atcPositionUpdate(const BlackMisc::Aviation::CCallsign &callsign, const BlackMisc::PhysicalQuantities::CFrequency &freq,
const BlackMisc::Geo::CCoordinateGeodetic &pos, const BlackMisc::PhysicalQuantities::CLength &range);
void atcDisconnected(const BlackMisc::Aviation::CCallsign &callsign);
@@ -117,6 +130,7 @@ namespace BlackSample
void pongReceived(const BlackMisc::Aviation::CCallsign &callsign, const BlackMisc::PhysicalQuantities::CTime &elapsedTime);
void textMessagesReceived(const BlackMisc::Network::CTextMessageList &messages);
void customPacketReceived(const BlackMisc::Aviation::CCallsign &callsign, const QString &packetId, const QStringList &data);
//! @}
private:
QMap<QString, std::function<void(QTextStream &)>> m_commands;

View File

@@ -16,6 +16,7 @@
using namespace BlackSample;
//! main
int main(int argc, char *argv[])
{
QCoreApplication app (argc, argv);

View File

@@ -18,6 +18,13 @@
namespace BlackSample
{
/*!
* \brief Simple console command reader
*
* This class reads the user input per line and emits each line
* as a command signals.
* This task is running in the background and does not block.
*/
class LineReader : public QThread
{
Q_OBJECT
@@ -26,9 +33,11 @@ namespace BlackSample
LineReader() {}
protected:
//! Run reader in background
void run();
signals:
//! User command
void command(const QString &line);
};

View File

@@ -11,6 +11,7 @@
#include "blackmisc/registermetadata.h"
#include <QApplication>
//! main
int main(int argc, char *argv[])
{
QApplication a(argc, argv);

View File

@@ -18,6 +18,7 @@
using namespace BlackMisc;
using namespace BlackMisc::PhysicalQuantities;
//! main
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);

View File

@@ -7,6 +7,8 @@
* contained in the LICENSE file.
*/
//! \cond PRIVATE
#include "audiodevicevatlib.h"
#include "blackmisc/logmessage.h"
@@ -16,11 +18,13 @@ using namespace BlackMisc::Aviation;
namespace BlackCore
{
//! Cast void* to a pointer of CAudioInputDeviceVatlib
CAudioInputDeviceVatlib *cbvar_cast_inputDevice(void *cbvar)
{
return static_cast<CAudioInputDeviceVatlib *>(cbvar);
}
//! Cast void* to a pointer of CAudioOutputDeviceVatlib
CAudioOutputDeviceVatlib *cbvar_cast_outputDevice(void *cbvar)
{
return static_cast<CAudioOutputDeviceVatlib *>(cbvar);
@@ -129,3 +133,5 @@ namespace BlackCore
cbvar_cast_outputDevice(cbVar)->m_devices.push_back(outputDevice);
}
}
//! \endcond

View File

@@ -3,6 +3,11 @@
//! \file
/*!
* \defgroup blackcore BlackCore Library
* Backend services of the swift project, like dealing with the network or the simulators.
*/
/*!
* \namespace BlackCore
* Backend services of the swift project, like dealing with the network or the simulators.
@@ -23,8 +28,9 @@
* Network settings traits.
*/
/**
/*!
* \defgroup dbus DBus related functions, classes, or definitions.
* \ingroup blackcore
*/
#endif // guard

View File

@@ -7,6 +7,8 @@
* contained in the LICENSE file.
*/
//! \cond PRIVATE
#include "networkvatlib.h"
#include "blackmisc/project.h"
#include "blackmisc/logmessage.h"
@@ -154,6 +156,7 @@ namespace BlackCore
}
}
//! Convert vatlib status code to INetwork::ConnectionStatus
INetwork::ConnectionStatus convertConnectionStatus(VatConnectionStatus status)
{
switch (status)
@@ -640,6 +643,7 @@ namespace BlackCore
/********************************** shimlib callbacks ************************************/
/********************************** * * * * * * * * * * * * * * * * * * * ************************************/
//! Cast void* to a pointer of CNetworkVatlib
CNetworkVatlib *cbvar_cast(void *cbvar)
{
return static_cast<CNetworkVatlib *>(cbvar);
@@ -1018,3 +1022,5 @@ namespace BlackCore
}
} // namespace
//! \endcond

View File

@@ -7,6 +7,8 @@
* contained in the LICENSE file.
*/
//! \cond PRIVATE
#include "voicechannelvatlib.h"
#include "blackmisc/logmessage.h"
@@ -177,6 +179,7 @@ namespace BlackCore
emit connectionStatusChanged(oldStatus, m_roomStatus);
}
//! Cast void* to a pointer of CVoiceChannelVatlib
CVoiceChannelVatlib *cbvar_cast_voiceChannel(void *cbvar)
{
return static_cast<CVoiceChannelVatlib *>(cbvar);
@@ -206,3 +209,5 @@ namespace BlackCore
obj->updateRoomStatus(channel, oldStatus, newStatus);
}
} // ns
//! \endcond

View File

@@ -7,6 +7,8 @@
* contained in the LICENSE file.
*/
//! \cond PRIVATE
#include "webreaderflags.h"
using namespace BlackMisc::Network;
@@ -47,7 +49,7 @@ namespace BlackCore
return f;
}
bool CWebReaderFlags::isFromSwiftDb(CEntityFlags::Entity entity)
bool CWebReaderFlags::isFromSwiftDb(BlackMisc::Network::CEntityFlags::Entity entity)
{
return isFromSwiftDb(entityToReader(entity));
}
@@ -58,3 +60,5 @@ namespace BlackCore
}
} // namespace
//! \endcond

View File

@@ -7,6 +7,8 @@
* contained in the LICENSE file.
*/
//! \cond PRIVATE
#include "datacache.h"
#include "blackmisc/logmessage.h"
#include "blackmisc/identifier.h"
@@ -16,6 +18,7 @@
namespace BlackMisc
{
class CDataCacheRevision::LockGuard
{
public:
@@ -445,3 +448,5 @@ namespace BlackMisc
return result;
}
}
//! \endcond

View File

@@ -7,6 +7,8 @@
* contained in the LICENSE file.
*/
//! \cond PRIVATE
#include "icons.h"
#include "blackmisc/project.h"
#include "blackmisc/fileutils.h"
@@ -1173,3 +1175,5 @@ namespace BlackMisc
}
} // namespace
//! \endcond

View File

@@ -36,8 +36,10 @@ namespace BlackMisc
namespace Private
{
//! \cond PRIVATE
//! \private
BLACKMISC_EXPORT QMutex *atomicSharedPtrMutex();
//! \endcond
//! \private
template <typename T>

View File

@@ -7,6 +7,8 @@
* contained in the LICENSE file.
*/
//! \cond PRIVATE
#include "loghandler.h"
#include "algorithm.h"
#include "worker.h"
@@ -23,6 +25,7 @@ namespace BlackMisc
return g_handler;
}
//! Qt message handler
void messageHandler(QtMsgType type, const QMessageLogContext &context, const QString &message)
{
CStatusMessage statusMessage(type, context, message);
@@ -264,3 +267,5 @@ namespace BlackMisc
}
}
}
//! \endcond

View File

@@ -7,6 +7,8 @@
* contained in the LICENSE file.
*/
//! \cond PRIVATE
#include "logmessage.h"
#include "blackmiscfreefunctions.h"
#include "indexsequence.h"
@@ -155,11 +157,13 @@ namespace BlackMisc
}
}
//! Does category contain flag?
bool hasFlag(const QString &category, const QString &flag)
{
return category.section("/", 1, -1).split("/").contains(flag);
}
//! Add flag to category
QString addFlag(QString category, const QString &flag)
{
if (category.isEmpty() || hasFlag(category, flag)) return category;
@@ -188,3 +192,5 @@ namespace BlackMisc
}
}
} // ns
//! \endcond

View File

@@ -39,7 +39,7 @@ namespace BlackMisc
}
}
QString CEntityFlags::flagToString(Entity flag)
QString CEntityFlags::flagToString(BlackMisc::Network::CEntityFlags::Entity flag)
{
QStringList list;
if (flag.testFlag(NoEntity)) list << "no data";

View File

@@ -7,6 +7,8 @@
* contained in the LICENSE file.
*/
//! \cond PRIVATE
#include "project.h"
#include "blackmisc/fileutils.h"
#include "blackmisc/stringutils.h"
@@ -310,6 +312,7 @@ namespace BlackMisc
return QProcessEnvironment::systemEnvironment().value(envVarPrivateSetupDir());
}
//! Get application directory
QString getApplicationDirImpl()
{
QFileInfo executable(QCoreApplication::applicationFilePath());
@@ -323,6 +326,7 @@ namespace BlackMisc
return s;
}
//! Get swift resource directory
QString getSwiftResourceDirImpl()
{
QDir dir(CProject::getApplicationDir());
@@ -347,6 +351,7 @@ namespace BlackMisc
return dir;
}
//! Get static database directory
QString getSwiftStaticDbFilesDirImpl()
{
QString d(CProject::getSwiftResourceDir());
@@ -362,6 +367,7 @@ namespace BlackMisc
return s;
}
//! Get images directory
QString getImagesDirImpl()
{
QString d(CProject::getSwiftResourceDir());
@@ -452,3 +458,5 @@ namespace BlackMisc
#undef BLACK_VERSION_STR
#undef BLACK_VERSION_STR_X
//! \endcond

View File

@@ -7,6 +7,8 @@
* contained in the LICENSE file.
*/
//! \cond PRIVATE
#include "propertyindexvariantmap.h"
#include "propertyindexlist.h"
#include "dictionary.h"
@@ -125,3 +127,5 @@ namespace BlackMisc
return BlackMisc::calculateHash(h, "CPropertyIndexVariantMap");
}
} // namespace
//! \endcond

View File

@@ -7,6 +7,8 @@
* contained in the LICENSE file.
*/
//! \cond PRIVATE
#include "blackmisc/valuecache.h"
#include "blackmisc/identifier.h"
#include "blackmisc/logmessage.h"
@@ -21,7 +23,7 @@ namespace BlackMisc
using Private::CValuePage;
// Used in asserts to protect against signed integer overflow.
//! Used in asserts to protect against signed integer overflow.
template <typename T>
bool isSafeToIncrement(const T &value) { return value < std::numeric_limits<T>::max(); }
@@ -557,3 +559,5 @@ namespace BlackMisc
}
}
//! \endcond

View File

@@ -7,6 +7,8 @@
* contained in the LICENSE file.
*/
//! \cond PRIVATE
#include "variant.h"
#include "blackmiscfreefunctions.h"
#include "icon.h"
@@ -238,9 +240,14 @@ namespace BlackMisc
}
}
// 2 functions required for unmarshallFromDbus
/*!
* 2 functions required for unmarshallFromDbus
* \internal
*/
//! @{
QVariant fixQVariantFromDbusArgument(const QVariant &variant, int localUserType);
QVariant complexQtTypeFromDbusArgument(const QDBusArgument &argument, int type);
//! @}
void CVariant::unmarshallFromDbus(const QDBusArgument &arg)
{
@@ -416,3 +423,5 @@ namespace BlackMisc
}
} // namespace
//! \endcond

View File

@@ -7,6 +7,8 @@
* contained in the LICENSE file.
*/
//! \cond PRIVATE
#include "metardecoder.h"
#include "blackmiscfreefunctions.h"
#include "blackmisc/logmessage.h"
@@ -804,7 +806,6 @@ namespace BlackMisc
virtual QString getDecoderType() const override { return "WindShear"; }
};
CMetarDecoder::CMetarDecoder()
{
allocateDecoders();
@@ -854,3 +855,5 @@ namespace BlackMisc
} // namespace
} // namespace
//! \endcond

View File

@@ -11,6 +11,7 @@
#include "blackmisc/logmessage.h"
#include "blackmisc/simulation/fscommon/modelmappingsprovidervpilot.h"
#include "blackmisc/blackmiscfreefunctions.h"
#include "blackmisc/makeunique.h"
using namespace BlackMisc::PhysicalQuantities;
using namespace BlackMisc::Simulation;

View File

@@ -7,6 +7,8 @@
* contained in the LICENSE file.
*/
//! \cond PRIVATE
#include "menus.h"
#include "blackmisc/blackmiscfreefunctions.h"
#include "blackmisc/makeunique.h"
@@ -16,14 +18,16 @@
namespace XBus
{
template <typename T> void *voidptr_cast(T i) // "safe" cast from integer to void*
//! "safe" cast from integer to void*
template <typename T> void *voidptr_cast(T i)
{
static_assert(std::is_integral<T>::value, "voidptr_cast expects an integer");
typedef typename std::conditional<std::is_signed<T>::value, intptr_t, uintptr_t>::type intptr_type;
return reinterpret_cast<void *>(static_cast<intptr_type>(i));
}
template <typename T> T intptr_cast(void *p) // "safe" cast from void* to integer
//! "safe" cast from void* to integer
template <typename T> T intptr_cast(void *p)
{
static_assert(std::is_integral<T>::value, "voidptr_cast returns an integer");
typedef typename std::conditional<std::is_signed<T>::value, intptr_t, uintptr_t>::type intptr_type;
@@ -119,3 +123,5 @@ namespace XBus
}
}
//! \endcond

View File

@@ -7,6 +7,8 @@
* contained in the LICENSE file.
*/
//! \cond PRIVATE
#ifndef NOMINMAX
#define NOMINMAX
#endif
@@ -17,6 +19,7 @@
namespace XBus
{
const int c_screenWidth = 1024;
const int c_screenHeight = 768;
const int c_boxLeft = 128;
@@ -141,3 +144,5 @@ namespace XBus
}
}
//! \endcond

View File

@@ -7,6 +7,8 @@
* contained in the LICENSE file.
*/
//! \cond PRIVATE
#ifndef NOMINMAX
#define NOMINMAX
#endif
@@ -38,9 +40,11 @@ namespace XBus
surfaces.lights.timeOffset = static_cast<quint16>(qrand() % 0xffff);
}
QString g_xplanePath;
QString g_sep;
//! Init global xplane path
void initXPlanePath()
{
char xplanePath[512];
@@ -297,7 +301,7 @@ namespace XBus
}
}
// memcmp function which ignores the header ("size" member) and compares only the payload (the rest of the struct)
//! memcmp function which ignores the header ("size" member) and compares only the payload (the rest of the struct)
template <typename T>
int memcmpPayload(T *dst, T *src)
{
@@ -306,7 +310,7 @@ namespace XBus
sizeof(*dst) - sizeof(dst->size));
}
// linearly interpolate angle in degrees
//! linearly interpolate angle in degrees
template <typename T>
T lerpDegrees(T from, T to, double factor)
{
@@ -394,3 +398,5 @@ namespace XBus
}
}
//! \endcond

View File

@@ -7,12 +7,15 @@
* contained in the LICENSE file.
*/
//! \cond PRIVATE
#include "weather.h"
#include <QDebug>
namespace XBus
{
//! Set cloud layer
template <class T>
void setCloudLayerImpl(T &layer, int base, int tops, int type, int coverage)
{
@@ -33,6 +36,7 @@ namespace XBus
}
}
//! Set wind layer
template <class T>
void setWindLayerImpl(T &layer, int altitude, float direction, int speed, int shearDirection, int shearSpeed, int turbulence)
{
@@ -56,3 +60,5 @@ namespace XBus
}
}
//! \endcond

View File

@@ -10,11 +10,16 @@
#ifndef BLACKCORETEST_H
#define BLACKCORETEST_H
//! \cond PRIVATE_TESTS
/*!
* \namespace BlackCoreTest
* \internal
* Unit tests for BlackCore. Unit tests do have their own namespace, so
* the regular namespace BlackCore is completely free of unit tests.
* Add any new tests to TestMain::unitMain as shown there.
*/
//! \endcond
#endif // guard

View File

@@ -7,6 +7,12 @@
* contained in the LICENSE file.
*/
//! \cond PRIVATE_TESTS
/*!
* \file
*/
#include "expect.h"
#include <QCoreApplication>
#include <QTimer>
@@ -108,4 +114,6 @@ void Expect::reportTimeout(const SourceLocation& srcloc, const QSet<const Expect
QTest::qFail(qPrintable(msg), qPrintable(srcloc.file), srcloc.line);
}
//! \endcond
} //namespace

View File

@@ -7,8 +7,6 @@
* contained in the LICENSE file.
*/
//! \file
#ifndef BLACKCORETEST_EXPECT_H
#define BLACKCORETEST_EXPECT_H
@@ -19,11 +17,19 @@
#include <QSet>
#include <functional>
//! \cond PRIVATE_TESTS
/*!
* \file
*/
namespace BlackCoreTest
{
class Expect;
//! Class representing a position in a source code file, for error reporting. Used in combination with the SOURCE_LOCATION macro.
/*!
* Class representing a position in a source code file, for error reporting. Used in combination with the SOURCE_LOCATION macro.
*/
class SourceLocation
{
public:
@@ -35,7 +41,9 @@ namespace BlackCoreTest
//! Evaluates to an instance of SourceLocation representing the position where the macro is used.
#define SOURCE_LOCATION (BlackCoreTest::SourceLocation(__FILE__, __LINE__))
//! RAII class for Qt signal/slot connections. All connections are closed when object is destroyed.
/*!
* RAII class for Qt signal/slot connections. All connections are closed when object is destroyed.
*/
class ConnectGuard
{
public:
@@ -45,7 +53,7 @@ namespace BlackCoreTest
//! Destructor.
~ConnectGuard() { cleanup(); }
//! Add a connection to the object.
//! Add a connection to the object..
ConnectGuard &operator+= (const QMetaObject::Connection &conn) { m_conns += conn; return *this; }
//! Disconnect and remove all stored connections.
@@ -74,14 +82,37 @@ namespace BlackCoreTest
* \param slot A pointer-to-member-function of the subject class.
* \return this object, so methods can be chained.
*/
//! @{
template <class F> ExpectUnit &send(F slot) { m_sends.push_back(std::bind(slot, subject<F>())); return *this; }
/*!
* \copydoc send(F)
* \param arg1
*/
template <class F, class T1> ExpectUnit &send(F slot, T1 arg1) { m_sends.push_back(std::bind(slot, subject<F>(), arg1)); return *this; }
/*!
* \copydoc send(F,T1)
* \param arg2
*/
template <class F, class T1, class T2> ExpectUnit &send(F slot, T1 arg1, T2 arg2) { m_sends.push_back(std::bind(slot, subject<F>(), arg1, arg2)); return *this; }
/*!
* \copydoc send(F,T1,T2)
* \param arg3
*/
template <class F, class T1, class T2, class T3> ExpectUnit &send(F slot, T1 arg1, T2 arg2, T3 arg3) { m_sends.push_back(std::bind(slot, subject<F>(), arg1, arg2, arg3)); return *this; }
/*!
* \copydoc send(F,T1,T2,T3)
* \param arg4
*/
template <class F, class T1, class T2, class T3, class T4> ExpectUnit &send(F slot, T1 arg1, T2 arg2, T3 arg3, T4 arg4) { m_sends.push_back(std::bind(slot, subject<F>(), arg1, arg2, arg3, arg4)); return *this; }
/*!
* \copydoc send(F,T1,T2,T3,T4)
* \param arg5
*/
template <class F, class T1, class T2, class T3, class T4, class T5> ExpectUnit &send(F slot, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5) { m_sends.push_back(std::bind(slot, subject<F>(), arg1, arg2, arg3, arg4, arg5)); return *this; }
//! @}
/*!
* Adds a signal to the list of signals which are expects to be received.
@@ -183,14 +214,33 @@ namespace BlackCoreTest
* Allows two or more units of expectation to be waited on simultaneously. Commonly valled via the EXPECT_WAIT macro.
* \param srcloc Represents the caller's location in the source code, for error reporting.
* \param timeout Time to wait in seconds. Qt event queue is processed when waiting.
* \param u1
*/
//! @{
void wait(const SourceLocation &srcloc, int timeout, const ExpectUnit &u1) { m_units.insert(&u1); wait(srcloc, timeout); }
/*!
* \copydoc wait(const SourceLocation&,int,const ExpectUnit&)
* \param u2
*/
void wait(const SourceLocation &srcloc, int timeout, const ExpectUnit &u1, const ExpectUnit &u2) { m_units.insert(&u1); m_units.insert(&u2); wait(srcloc, timeout); }
/*!
* \copydoc wait(const SourceLocation&,int,const ExpectUnit&,const ExpectUnit&)
* \param u3
*/
void wait(const SourceLocation &srcloc, int timeout, const ExpectUnit &u1, const ExpectUnit &u2, const ExpectUnit &u3) { m_units.insert(&u1); m_units.insert(&u2); m_units.insert(&u3); wait(srcloc, timeout); }
/*!
* \copydoc wait(const SourceLocation&,int,const ExpectUnit&,const ExpectUnit&,const ExpectUnit&)
* \param u4
*/
void wait(const SourceLocation &srcloc, int timeout, const ExpectUnit &u1, const ExpectUnit &u2, const ExpectUnit &u3, const ExpectUnit &u4) { m_units.insert(&u1); m_units.insert(&u2); m_units.insert(&u3); m_units.insert(&u4); wait(srcloc, timeout); }
/*!
* \copydoc wait(const SourceLocation&,int,const ExpectUnit&,const ExpectUnit&,const ExpectUnit&,const ExpectUnit&)
* \param u5
*/
void wait(const SourceLocation &srcloc, int timeout, const ExpectUnit &u1, const ExpectUnit &u2, const ExpectUnit &u3, const ExpectUnit &u4, const ExpectUnit &u5) { m_units.insert(&u1); m_units.insert(&u2); m_units.insert(&u3); m_units.insert(&u4); m_units.insert(&u5); wait(srcloc, timeout); }
//! @}
private:
friend class ExpectUnit;
@@ -216,14 +266,30 @@ namespace BlackCoreTest
* Allows two or more units of expectation to be waited on simultaneously.
* \param EXP Instance of Expect on which to call wait().
* \param TIME Time to wait in seconds. Qt event queue is processed when waiting.
* \param U1, U2
*/
//! @{
#define EXPECT_WAIT_2(EXP, TIME, U1, U2) ((EXP).wait(SOURCE_LOCATION, (TIME), (U1), (U2)))
/*!
* \copydoc EXPECT_WAIT_2(EXP,TIME,U1,U2)
* \param U3
*/
#define EXPECT_WAIT_3(EXP, TIME, U1, U2, U3) ((EXP).wait(SOURCE_LOCATION, (TIME), (U1), (U2), (U3)))
/*!
* \copydoc EXPECT_WAIT_3(EXP,TIME,U1,U2,U3)
* \param U4
*/
#define EXPECT_WAIT_4(EXP, TIME, U1, U2, U3, U4) ((EXP).wait(SOURCE_LOCATION, (TIME), (U1), (U2), (U3), (U4)))
/*!
* \copydoc EXPECT_WAIT_4(EXP,TIME,U1,U2,U3,U4)
* \param U5
*/
#define EXPECT_WAIT_5(EXP, TIME, U1, U2, U3, U4, U5) ((EXP).wait(SOURCE_LOCATION, (TIME), (U1), (U2), (U3), (U4), (U5)))
//! @}
} // ns
//! \endcond
#endif // guard

View File

@@ -7,6 +7,12 @@
* contained in the LICENSE file.
*/
//! \cond PRIVATE_TESTS
/*!
* \file
*/
#include "testblackcoremain.h"
#include <QCoreApplication>
#include <QDebug>
@@ -21,3 +27,5 @@ int main(int argc, char *argv[])
return CBlackCoreTestMain::unitMain(argc, argv);
}
//! \endcond

View File

@@ -7,6 +7,12 @@
* contained in the LICENSE file.
*/
//! \cond PRIVATE_TESTS
/*!
* \file
*/
#include "testblackcoremain.h"
#include "testinterpolator.h"
#include "testreaders.h"
@@ -36,3 +42,5 @@ namespace BlackCoreTest
return status;
}
} // namespace
//! \endcond

View File

@@ -7,11 +7,15 @@
* contained in the LICENSE file.
*/
//! \file
#ifndef BLACKCORETEST_TESTMAIN_H
#define BLACKCORETEST_TESTMAIN_H
//! \cond PRIVATE_TESTS
/*!
* \file
*/
#include "blackmisc/valueobject.h" // for qHash overload, include before Qt stuff due GCC issue
#include <QtTest/QtTest>
@@ -31,4 +35,6 @@ namespace BlackCoreTest
};
}
//! \endcond
#endif // guard

View File

@@ -7,6 +7,13 @@
* contained in the LICENSE file.
*/
//! \cond PRIVATE_TESTS
/*!
* \file
* \ingroup testblackcore
*/
#include "testinterpolator.h"
#include "blackcore/interpolatorlinear.h"
#include "blackmisc/simulation/remoteaircraftproviderdummy.h"
@@ -148,3 +155,5 @@ namespace BlackCoreTest
}
} // namespace
//! \endcond

View File

@@ -7,11 +7,15 @@
* contained in the LICENSE file.
*/
//! \file
#ifndef BLACKCORETEST_TESTINTERPOLATOR_H
#define BLACKCORETEST_TESTINTERPOLATOR_H
//! \cond PRIVATE_TESTS
/*!
* \file
*/
#include "blackmisc/aviation/aircraftsituation.h"
#include "blackmisc/aviation/aircraftparts.h"
@@ -20,7 +24,9 @@
namespace BlackCoreTest
{
//! Interpolator classes basic tests
/*!
* Interpolator classes basic tests
*/
class CTestInterpolator : public QObject
{
Q_OBJECT
@@ -44,4 +50,6 @@ namespace BlackCoreTest
} // namespace
//! \endcond
#endif // guard

View File

@@ -7,6 +7,12 @@
* contained in the LICENSE file.
*/
//! \cond PRIVATE_TESTS
/*!
* \file
*/
#include "testnetwork.h"
#include "expect.h"
#include "blackmisc/network/networkutils.h"
@@ -91,3 +97,5 @@ namespace BlackCoreTest
}
}
//! \endcond

View File

@@ -7,11 +7,15 @@
* contained in the LICENSE file.
*/
//! \file
#ifndef BLACKCORETEST_TESTNETWORK_H
#define BLACKCORETEST_TESTNETWORK_H
//! \cond PRIVATE_TESTS
/*!
* \file
*/
#include "blackcore/networkvatlib.h"
#include "blackcore/data/globalsetup.h"
#include "blackmisc/simulation/ownaircraftproviderdummy.h"
@@ -20,7 +24,9 @@
namespace BlackCoreTest
{
//! INetwork implementation classes tests
/*!
* INetwork implementation classes tests
*/
class CTestNetwork : public QObject
{
Q_OBJECT
@@ -48,4 +54,6 @@ namespace BlackCoreTest
} //namespace
//! \endcond
#endif // guard

View File

@@ -7,6 +7,12 @@
* contained in the LICENSE file.
*/
//! \cond PRIVATE_TESTS
/*!
* \file
*/
#include "testreaders.h"
#include "expect.h"
#include "blackcore/data/globalsetup.h"
@@ -86,3 +92,5 @@ namespace BlackCoreTest
return true;
}
} // ns
//! \endcond

View File

@@ -7,11 +7,15 @@
* contained in the LICENSE file.
*/
//! \file
#ifndef BLACKCORETEST_TESTREADERS_H
#define BLACKCORETEST_TESTREADERS_H
//! \cond PRIVATE_TESTS
/*!
* \file
*/
#include "blackcore/networkvatlib.h"
#include "blackcore/modeldatareader.h"
#include "blackcore/icaodatareader.h"
@@ -19,7 +23,7 @@
namespace BlackCoreTest
{
/**
/*!
* Test data readers (for bookings, JSON, etc.)
*/
class CTestReaders : public QObject
@@ -48,4 +52,6 @@ namespace BlackCoreTest
} //namespace
//! \endcond
#endif // guard

View File

@@ -10,6 +10,8 @@
#ifndef BLACKGUITEST_H
#define BLACKGUITEST_H
//! \cond PRIVATE_TESTS
/*!
* \namespace BlackGuiTest
* Unit tests for BlackGui. Unit tests do have their own namespace, so
@@ -17,4 +19,6 @@
* Add any new tests to TestMain::unitMain as shown there.
*/
//! \endcond
#endif // guard

View File

@@ -7,6 +7,12 @@
* contained in the LICENSE file.
*/
//! \cond PRIVATE_TESTS
/*!
* \file
*/
#include "testblackguimain.h"
#include <QCoreApplication>
#include <QDebug>
@@ -21,3 +27,5 @@ int main(int argc, char *argv[])
return CBlackGuiTestMain::unitMain(argc, argv);
}
//! \endcond

View File

@@ -7,6 +7,12 @@
* contained in the LICENSE file.
*/
//! \cond PRIVATE_TESTS
/*!
* \file
*/
#include "testblackguimain.h"
#include "testutils.h"
@@ -25,3 +31,5 @@ namespace BlackCoreTest
return status;
}
} // namespace
//! \endcond

View File

@@ -7,7 +7,11 @@
* contained in the LICENSE file.
*/
//! \file
//! \cond PRIVATE_TESTS
/*!
* \file
*/
#ifndef BLACKCORETEST_TESTMAIN_H
#define BLACKCORETEST_TESTMAIN_H
@@ -31,4 +35,6 @@ namespace BlackCoreTest
};
}
//! \endcond
#endif // guard

View File

@@ -7,6 +7,12 @@
* contained in the LICENSE file.
*/
//! \cond PRIVATE_TESTS
/*!
* \file
*/
#include "testutils.h"
#include "blackgui/guiutility.h"
@@ -26,3 +32,5 @@ namespace BlackCoreTest
QVERIFY2(!CGuiUtility::lenientTitleComparison("foo", "bar"), "wrong title mismatch");
}
} // ns
//! \endcond

View File

@@ -7,7 +7,11 @@
* contained in the LICENSE file.
*/
//! \file
//! \cond PRIVATE_TESTS
/*!
* \file
*/
#ifndef BLACKCORETEST_TESTUTILS_H
#define BLACKCORETEST_TESTUTILS_H
@@ -35,4 +39,6 @@ namespace BlackCoreTest
} //namespace
//! \endcond
#endif // guard

View File

@@ -10,11 +10,16 @@
#ifndef BLACKMISCTEST_H
#define BLACKMISCTEST_H
//! \cond PRIVATE_TESTS
/*!
* @namespace BlackMiscTest
* \namespace BlackMiscTest
* \internal
* Unit tests for BlackMisc. Unit tests do have their own namespace, so
* the regular namespace BlackMisc is completely free of unit tests.
* Add any new tests to TestMain::unitMain as shown there.
*/
//! \endcond
#endif // guard

View File

@@ -7,6 +7,13 @@
* contained in the LICENSE file.
*/
//! \cond PRIVATE_TESTS
/*!
* \file
* \internal
*/
#include "testblackmiscmain.h"
#include "blackmisc/registermetadata.h"
#include <QCoreApplication>
@@ -29,3 +36,5 @@ int main(int argc, char *argv[])
BlackMisc::registerMetadata();
return CBlackMiscTestMain::unitMain(argc, argv);;
}
//! \endcond

View File

@@ -7,6 +7,12 @@
* contained in the LICENSE file.
*/
//! \cond PRIVATE_TESTS
/*!
* \file
*/
#include "testaviation.h"
#include "blackmisc/pq/constants.h"
#include "blackmisc/aviation/heading.h"
@@ -184,3 +190,5 @@ namespace BlackMiscTest
}
} // namespace
//! \endcond

View File

@@ -7,17 +7,23 @@
* contained in the LICENSE file.
*/
//! \file
#ifndef BLACKMISCTEST_TESTAVIATIONBASE_H
#define BLACKMISCTEST_TESTAVIATIONBASE_H
//! \cond PRIVATE_TESTS
/*!
* \file
*/
#include <QtTest/QtTest>
namespace BlackMiscTest
{
//! Aviation classes basic tests
/*!
* Aviation classes basic tests
*/
class CTestAviation : public QObject
{
Q_OBJECT
@@ -45,4 +51,6 @@ namespace BlackMiscTest
} // namespace
//! \endcond
#endif // guard

View File

@@ -7,6 +7,12 @@
* contained in the LICENSE file.
*/
//! \cond PRIVATE_TESTS
/*!
* \file
*/
#include "testphysicalquantities.h"
#include "testaviation.h"
#include "testgeo.h"
@@ -52,3 +58,5 @@ namespace BlackMiscTest
return status;
}
} // namespace
//! \endcond

View File

@@ -10,13 +10,21 @@
#ifndef BLACKMISCTEST_TESTMAIN_H
#define BLACKMISCTEST_TESTMAIN_H
//! \cond PRIVATE_TESTS
/*!
* \file
*/
#include <QtTest/QtTest>
namespace BlackMiscTest
{
//! Class firing all unit tests in this namespace.
//! Avoids clashes with other main(..) functions and allows to fire the test cases
//! simply from any other main.
/*!
* Class firing all unit tests in this namespace.
* Avoids clashes with other main(..) functions and allows to fire the test cases
* simply from any other main.
*/
class CBlackMiscTestMain
{
public:
@@ -25,4 +33,6 @@ namespace BlackMiscTest
};
}
//! \endcond
#endif // guard

View File

@@ -7,6 +7,12 @@
* contained in the LICENSE file.
*/
//! \cond PRIVATE_TESTS
/*!
* \file
*/
#include "testcontainers.h"
#include "testvalueobject.h"
#include "blackmisc/registermetadata.h"
@@ -279,3 +285,5 @@ namespace BlackMiscTest
}
} //namespace
//! \endcond

View File

@@ -7,11 +7,15 @@
* contained in the LICENSE file.
*/
//! \file
#ifndef BLACKMISCTEST_TESTCONTAINERS_H
#define BLACKMISCTEST_TESTCONTAINERS_H
//! \cond PRIVATE_TESTS
/*!
* \file
*/
#include <QtTest/QtTest>
namespace BlackMiscTest
@@ -37,4 +41,6 @@ namespace BlackMiscTest
} // namespace
//! \endcond
#endif // guard

View File

@@ -7,6 +7,12 @@
* contained in the LICENSE file.
*/
//! \cond PRIVATE_TESTS
/*!
* \file
*/
#include "testgeo.h"
#include "blackmisc/geo/latitude.h"
#include "blackmisc/geo/longitude.h"
@@ -29,3 +35,5 @@ namespace BlackMiscTest
}
} // namespace
//! \endcond

View File

@@ -7,11 +7,15 @@
* contained in the LICENSE file.
*/
//! \file
#ifndef BLACKMISCTEST_TESTGEO_H
#define BLACKMISCTEST_TESTGEO_H
//! \cond PRIVATE_TESTS
/*!
* \file
*/
#include <QtTest/QtTest>
namespace BlackMiscTest
@@ -33,4 +37,6 @@ namespace BlackMiscTest
} // namespace
//! \endcond
#endif // guard

View File

@@ -7,6 +7,12 @@
* contained in the LICENSE file.
*/
//! \cond PRIVATE_TESTS
/*!
* \file
*/
#include "testidentifier.h"
#include "blackmisc/blackmiscfreefunctions.h"
#include "blackmisc/identifierlist.h"
@@ -37,3 +43,5 @@ namespace BlackMiscTest
{ }
} //namespace
//! \endcond

View File

@@ -7,11 +7,15 @@
* contained in the LICENSE file.
*/
//! \file
#ifndef BLACKMISCTEST_TESTIDENTIFIER_H
#define BLACKMISCTEST_TESTIDENTIFIER_H
//! \cond PRIVATE_TESTS
/*!
* \file
*/
#include "blackmisc/identifiable.h"
#include <QtTest/QtTest>
@@ -41,4 +45,6 @@ namespace BlackMiscTest
} // namespace
//! \endcond
#endif // guard

View File

@@ -7,6 +7,12 @@
* contained in the LICENSE file.
*/
//! \cond PRIVATE_TESTS
/*!
* \ingroup testblackmisc
*/
#include "testinput.h"
#include "blackmisc/input/keyboardkey.h"
#include "blackmisc/input/hotkeycombination.h"
@@ -173,3 +179,5 @@ namespace BlackMiscTest
}
} // namespace
//! \endcond

View File

@@ -7,11 +7,15 @@
* contained in the LICENSE file.
*/
//! \file
#ifndef BLACKMISCTEST_TESTINPUT_H
#define BLACKMISCTEST_TESTINPUT_H
//! \cond PRIVATE_TESTS
/*!
* \file
*/
#include <QtTest/QtTest>
namespace BlackMiscTest
@@ -42,4 +46,6 @@ namespace BlackMiscTest
};
} // namespace
//! \endcond
#endif // guard

View File

@@ -7,6 +7,12 @@
* contained in the LICENSE file.
*/
//! \cond PRIVATE_TESTS
/*!
* \file
*/
#include "testmath.h"
#include "blackmisc/math/mathutils.h"
@@ -36,3 +42,5 @@ namespace BlackMiscTest
}
} // namespace
//! \endcond

View File

@@ -7,17 +7,23 @@
* contained in the LICENSE file.
*/
//! \file
#ifndef BLACKMISCTEST_TESTMATH_H
#define BLACKMISCTEST_TESTMATH_H
//! \cond PRIVATE_TESTS
/*!
* \file
*/
#include <QtTest/QtTest>
namespace BlackMiscTest
{
//! Math classes tests
/*!
* Math classes tests
*/
class CTestMath : public QObject
{
Q_OBJECT
@@ -33,4 +39,6 @@ namespace BlackMiscTest
} // namespace
//! \endcond
#endif // guard

View File

@@ -7,6 +7,12 @@
* contained in the LICENSE file.
*/
//! \cond PRIVATE_TESTS
/*!
* \file
*/
#include "testphysicalquantities.h"
using namespace BlackMisc::PhysicalQuantities;
@@ -279,3 +285,5 @@ namespace BlackMiscTest
}
} // namespace
//! \endcond

View File

@@ -7,11 +7,15 @@
* contained in the LICENSE file.
*/
//! \file
#ifndef BLACKMISCTEST_TESTPHYSICALQUANTITIESBASE_H
#define BLACKMISCTEST_TESTPHYSICALQUANTITIESBASE_H
//! \cond PRIVATE_TESTS
/*!
* \file
*/
#include <QtTest/QtTest>
#include "blackmisc/pq/constants.h"
@@ -70,4 +74,6 @@ namespace BlackMiscTest
} // namespace
//! \endcond
#endif // guard

View File

@@ -7,6 +7,12 @@
* contained in the LICENSE file.
*/
//! \cond PRIVATE_TESTS
/*!
* \file
*/
#include "testvaluecache.h"
#include "blackmisc/worker.h"
#include "blackmisc/identifier.h"
@@ -55,6 +61,7 @@ namespace BlackMiscTest
QVERIFY(cache.getAllValues() == testDataCombined);
}
//! \cond PRIVATE
void waitForQueueOf(QObject *object)
{
if (object->thread() != QThread::currentThread())
@@ -96,6 +103,7 @@ namespace BlackMiscTest
singleShotAndWait(&user2, [ & ] { QVERIFY(user2.m_value2.get() == 42); });
QVERIFY(user1.m_value2.get() == 42);
}
//! \endcond
void CTestValueCache::localOnly()
{
@@ -231,6 +239,7 @@ namespace BlackMiscTest
QCOMPARE(cache2.getAllValues(), testData);
}
//! Is value between 0 - 100?
bool validator(int value)
{
return value >= 0 && value <= 100;
@@ -260,3 +269,5 @@ namespace BlackMiscTest
return false;
}
} // ns
//! \endcond

View File

@@ -7,11 +7,15 @@
* contained in the LICENSE file.
*/
//! \file
#ifndef BLACKMISCTEST_TESTVALUECACHE_H
#define BLACKMISCTEST_TESTVALUECACHE_H
//! \cond PRIVATE_TESTS
/*!
* \file
*/
#include "blackmisc/valuecache.h"
#include <QtTest/QtTest>
#include <future>
@@ -77,4 +81,6 @@ namespace BlackMiscTest
}
//! \endcond
#endif

View File

@@ -7,6 +7,12 @@
* contained in the LICENSE file.
*/
//! \cond PRIVATE_TESTS
/*!
* \file
*/
#include "testvalueobject.h"
#include "blackmisc/blackmiscfreefunctions.h"
#include <tuple>
@@ -63,3 +69,5 @@ namespace BlackMisc
}
} // namespace
//! \endcond

View File

@@ -7,11 +7,15 @@
* contained in the LICENSE file.
*/
//! \file
#ifndef BLACKMISC_TESTVALUEOBJECT_H
#define BLACKMISC_TESTVALUEOBJECT_H
//! \cond PRIVATE_TESTS
/*!
* \file
*/
#include "blackmisc/propertyindex.h"
#include "blackmisc/sequence.h"
#include "blackmisc/collection.h"
@@ -89,9 +93,17 @@ Q_DECLARE_METATYPE(BlackMisc::CNotHashable)
// We need to typedef because 'commas' confuse the Q_DECLARE_METATYPE macro
// https://bugreports.qt-project.org/browse/QTBUG-11485
//! Test value object dictionary using ordered container
typedef BlackMisc::CDictionary<BlackMisc::CTestValueObject, BlackMisc::CTestValueObject> CValueObjectDictionary;
//! Test value object dictionary using unordered container
typedef BlackMisc::CDictionary<BlackMisc::CTestValueObject, BlackMisc::CTestValueObject, QHash> CValueObjectHashDictionary;
//! Test value object dictionary using ordered container with not hashable key
typedef BlackMisc::CDictionary<BlackMisc::CNotHashable, QString> CNotHashableDictionary;
//! Test value object dictionary using unordered container with not hashable key
typedef BlackMisc::CDictionary<BlackMisc::CNotHashable, QString, QMap> CNotHashableMapDictionary;
Q_DECLARE_METATYPE(CValueObjectDictionary)
Q_DECLARE_METATYPE(CNotHashableDictionary)
@@ -104,4 +116,6 @@ static_assert(std::is_same<CNotHashableDictionary::impl_type, CNotHashableMapDic
"Expected CDictionary<CNotHashableDictionary, Value> to use QMap");
#endif // ! Q_CC_MSVC
//! \endcond
#endif // guard

View File

@@ -7,6 +7,12 @@
* contained in the LICENSE file.
*/
//! \cond PRIVATE_TESTS
/*!
* \file
*/
#include "testvariantandmap.h"
#include "blackmisc/aviation/atcstation.h"
#include "blackmisc/propertyindexallclasses.h"
@@ -115,3 +121,5 @@ namespace BlackMiscTest
}
} // namespace
//! \endcond

View File

@@ -7,11 +7,15 @@
* contained in the LICENSE file.
*/
//! \file
#ifndef BLACKMISCTEST_TESTVARIANTANDMAP_H
#define BLACKMISCTEST_TESTVARIANTANDMAP_H
//! \cond PRIVATE_TESTS
/*!
* \file
*/
#include "blackmisc/pq/constants.h"
#include "blackmisc/aviation/atcstation.h"
#include <QtTest/QtTest>
@@ -36,4 +40,6 @@ namespace BlackMiscTest
} // namespace
//! \endcond
#endif // guard

View File

@@ -7,6 +7,12 @@
* contained in the LICENSE file.
*/
//! \cond PRIVATE_TESTS
/*!
* \file
*/
#include "testweather.h"
#include "blackmisc/weather/metardecoder.h"
@@ -81,3 +87,5 @@ namespace BlackMiscTest
}
} // namespace
//! \endcond

View File

@@ -7,11 +7,15 @@
* contained in the LICENSE file.
*/
//! \file
#ifndef BLACKMISCTEST_TESTWEATHER_H
#define BLACKMISCTEST_TESTWEATHER_H
//! \cond PRIVATE_TESTS
/*!
* \file
*/
#include <QtTest/QtTest>
namespace BlackMiscTest
@@ -33,4 +37,6 @@ namespace BlackMiscTest
} // namespace
//! \endcond
#endif // guard