forked from Sepanta/console-emulator
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
46 lines
636 B
46 lines
636 B
3 years ago
|
#include <QtTest>
|
||
|
|
||
|
#include "TestDataSender.h"
|
||
|
#include "model/Console.h"
|
||
|
|
||
|
class ConsoleTest : public QObject
|
||
|
{
|
||
|
Q_OBJECT
|
||
|
|
||
|
public:
|
||
|
ConsoleTest();
|
||
|
~ConsoleTest();
|
||
|
|
||
|
private slots:
|
||
|
void test_case1();
|
||
|
|
||
|
};
|
||
|
|
||
|
ConsoleTest::ConsoleTest()
|
||
|
{
|
||
|
|
||
|
}
|
||
|
|
||
|
ConsoleTest::~ConsoleTest()
|
||
|
{
|
||
|
|
||
|
}
|
||
|
|
||
|
void ConsoleTest::test_case1()
|
||
|
{
|
||
|
Console c;
|
||
|
auto t = new TestDataSender;
|
||
|
c.injectDataSender(t);
|
||
|
c.test();
|
||
|
|
||
|
QByteArray arr;
|
||
|
arr.append(0x01);
|
||
|
arr.append(0x04);
|
||
|
arr.append(0x05);
|
||
|
QCOMPARE(t->consoleData, arr);
|
||
|
}
|
||
|
|
||
|
QTEST_APPLESS_MAIN(ConsoleTest)
|
||
|
|
||
|
#include "tst_console.moc"
|