mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-24 23:30:03 +02:00
first test for ZmqSocket
This commit is contained in:
parent
7c23f1e42c
commit
12b40a44a2
@ -10,4 +10,5 @@ target_sources(tests PRIVATE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test-TypeTraits.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test-UdpRxSocket.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test-logger.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test-ZmqSocket.cpp
|
||||
)
|
25
slsSupportLib/tests/test-ZmqSocket.cpp
Normal file
25
slsSupportLib/tests/test-ZmqSocket.cpp
Normal file
@ -0,0 +1,25 @@
|
||||
#include "ZmqSocket.h"
|
||||
#include "catch.hpp"
|
||||
|
||||
TEST_CASE("Send header on localhost") {
|
||||
constexpr int port = 50001;
|
||||
ZmqSocket sub("localhost", port);
|
||||
sub.Connect();
|
||||
|
||||
ZmqSocket pub(port, "*");
|
||||
|
||||
|
||||
zmqHeader header;
|
||||
|
||||
header.fname = "hej";
|
||||
header.data = 0;
|
||||
|
||||
pub.SendHeader(0, header);
|
||||
|
||||
|
||||
|
||||
zmqHeader received_header;
|
||||
sub.ReceiveHeader(0, received_header, 0);
|
||||
|
||||
REQUIRE(received_header.fname == "hej");
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user