test: Add data transfer and checks to protocol tests

This commit is contained in:
Alexey Rybalchenko
2023-06-13 11:53:49 +02:00
committed by Dennis Klein
parent f278e7e312
commit 3decac58fc
4 changed files with 58 additions and 15 deletions

View File

@@ -1,5 +1,5 @@
/********************************************************************************
* Copyright (C) 2015-2022 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
* Copyright (C) 2015-2023 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
* *
* This software is distributed under the terms of the *
* GNU Lesser General Public Licence (LGPL) version 3, *
@@ -26,12 +26,17 @@ class Req : public Device
auto Run() -> void override
{
auto request = NewMessage();
auto request = NewSimpleMessageFor("data", 0, "request");
Send(request, "data");
auto reply = NewMessage();
if (Receive(reply, "data") >= 0) {
LOG(info) << "received reply";
auto content = std::string{static_cast<char*>(reply->GetData()), reply->GetSize()};
LOG(info) << "Transferred reply of size: " << reply->GetSize() << ", content: " << content;
if (content != "reply") {
ChangeStateOrThrow(Transition::ErrorFound);
}
}
};
};