mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-12 12:57:13 +02:00
first test for ZmqSocket
This commit is contained in:
@ -10,4 +10,5 @@ target_sources(tests PRIVATE
|
|||||||
${CMAKE_CURRENT_SOURCE_DIR}/test-TypeTraits.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}/test-TypeTraits.cpp
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/test-UdpRxSocket.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}/test-UdpRxSocket.cpp
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/test-logger.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");
|
||||||
|
}
|
Reference in New Issue
Block a user