Initial commit
This commit is contained in:
commit
b7d90b9afe
16245 files changed
+3396666
No files matched your search
+57
@@ -0,0 +1,57 @@
|
||||
/**
|
||||
* AES unit test fire automaton
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
#include <QtCore>
|
||||
#include <QMetaType>
|
||||
|
||||
#include <AreaEffectSimulation/Utils/fire_automaton.h>
|
||||
|
||||
Q_DECLARE_METATYPE(int32_t)
|
||||
|
||||
namespace AreaEffectSimulation
|
||||
{
|
||||
class TestFireAutomaton: public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
private slots:
|
||||
void initTestCase();
|
||||
void init();
|
||||
|
||||
void testResumePaused();
|
||||
void testStop();
|
||||
void testStates();
|
||||
void testSchedule_0();
|
||||
void testSchedule_1();
|
||||
void testSchedule_2();
|
||||
void testSchedule_3();
|
||||
void testSchedule_4();
|
||||
|
||||
private:
|
||||
struct FireEvent
|
||||
{
|
||||
qint64 time;
|
||||
int32_t id;
|
||||
};
|
||||
|
||||
void testScheduling(int32_t time, FireAutomaton::TimeType type, int32_t numberOfRounds, const QVector<int32_t>& effectorIds,
|
||||
const QString& pattern, QVector<qint64> expectedDelays, QVector<QVector<int32_t>> expectedSchedule);
|
||||
void testStepping(int32_t numberOfRounds, const QVector<int32_t>& effectorIds, const QString& pattern, QVector<QVector<int32_t>> expectedSchedule);
|
||||
void fireReceived(int32_t id);
|
||||
|
||||
QVector<FireEvent> m_receivedFire;
|
||||
qint64 m_finishedTime;
|
||||
};
|
||||
|
||||
static bool withinTolerance(qint64 measured, qint64 expected, qint64 tolerance) {
|
||||
return qAbs(measured-expected) <= tolerance;
|
||||
};
|
||||
|
||||
} // namespace AreaEffectSimulation
|
||||
Reference in new issue
Block a user