FairMQ: Add unit tests for PAIR channel type

This commit is contained in:
Dennis Klein
2018-02-14 16:28:26 +01:00
committed by Mohammad Al-Turany
parent 9b7841e89e
commit 72bc86f006
6 changed files with 272 additions and 0 deletions

View File

@@ -0,0 +1,40 @@
/********************************************************************************
* Copyright (C) 2015-2017 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
* *
* This software is distributed under the terms of the *
* GNU Lesser General Public Licence (LGPL) version 3, *
* copied verbatim in the file "LICENSE" *
********************************************************************************/
#include <FairMQDevice.h>
namespace fair
{
namespace mq
{
namespace test
{
class PairLeft : public FairMQDevice
{
protected:
auto Init() -> void override
{
std::this_thread::sleep_for(std::chrono::milliseconds(200));
}
auto Reset() -> void override
{
std::this_thread::sleep_for(std::chrono::milliseconds(100));
}
auto Run() -> void
{
auto msg = FairMQMessagePtr{NewMessage()};
Send(msg, "data");
};
};
} // namespace test
} // namespace mq
} // namespace fair

View File

@@ -0,0 +1,44 @@
/********************************************************************************
* Copyright (C) 2015-2017 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
* *
* This software is distributed under the terms of the *
* GNU Lesser General Public Licence (LGPL) version 3, *
* copied verbatim in the file "LICENSE" *
********************************************************************************/
#include <FairMQDevice.h>
namespace fair
{
namespace mq
{
namespace test
{
class PairRight : public FairMQDevice
{
protected:
auto Init() -> void override
{
std::this_thread::sleep_for(std::chrono::milliseconds(200));
}
auto Reset() -> void override
{
std::this_thread::sleep_for(std::chrono::milliseconds(100));
}
auto Run() -> void
{
auto msg = FairMQMessagePtr{NewMessage()};
if (Receive(msg, "data") >= 0)
{
LOG(info) << "PAIR test successfull";
}
};
};
} // namespace test
} // namespace mq
} // namespace fair

View File

@@ -6,6 +6,8 @@
* copied verbatim in the file "LICENSE" *
********************************************************************************/
#include "devices/TestPairLeft.cxx"
#include "devices/TestPairRight.cxx"
#include "devices/TestPollIn.cxx"
#include "devices/TestPollOut.cxx"
#include "devices/TestPub.cxx"
@@ -70,6 +72,14 @@ auto getDevice(const FairMQProgOptions& config) -> FairMQDevicePtr
{
return new PollIn;
}
else if (0 == id.find("pairleft_"))
{
return new PairLeft;
}
else if (0 == id.find("pairright_"))
{
return new PairRight;
}
else
{
cerr << "Don't know id '" << id << "'" << endl;