Beispiel #1
0
void DataMethodsTests::TestServeReceivedMessageChangeMinimumToExecution() {
    CReceiverWrapper vReceiver;


    vReceiver.ForTestSetSocket(new QTcpSocket());
    char vMessage[] {">>1876<"};
    size_t vMessageSize {sizeof(vMessage) - 1};
    vReceiver.ForTestSetMessageSize(vMessageSize);
    vReceiver.ForTestSetMessage(vMessage);
    vReceiver.ForTestSetReceiveBuffer(new QByteArray("Test data"));
    gRepository.RefreshChecksums();

    vReceiver.ForTestServeReceivedMessage();

    QCOMPARE(vReceiver.ForTestGetMessageSize(), 0);
    QCOMPARE(*vReceiver.ForTestGetReveiveBuffer(), QByteArray());
}
Beispiel #2
0
void DataMethodsTests::TestServeReceivedMessageChangeAllParam() {
    CReceiverWrapper vReceiver;

    vReceiver.ForTestSetSocket(new QTcpSocket());
    char vMessage[] {">>645<"};
    size_t vMessageSize {sizeof(vMessage) - 1};
    vReceiver.ForTestSetMessageSize(vMessageSize);
    vReceiver.ForTestSetMessage(vMessage);
    vReceiver.ForTestSetReceiveBuffer(new QByteArray("Test data"));
    gRepository.RefreshChecksums();

    vReceiver.ForTestSetDataSize(new int32_t(50));
    vReceiver.ForTestSetReceiveByteCount(100);
    vReceiver.ForTestServeReceivedMessage();

    QCOMPARE(*vReceiver.ForTestGetDataSize(), 0);
    QCOMPARE(vReceiver.ForTestGetMessageSize(), 0);
    QCOMPARE(vReceiver.ForTestGetReceiveByteCount(), 0);
    QCOMPARE(*vReceiver.ForTestGetReveiveBuffer(), QByteArray());
}