test_hello_msg.cpp
Go to the documentation of this file.
1 /* SPDX-License-Identifier: MPL-2.0 */
2 
3 #include "testutil.hpp"
4 #include "testutil_unity.hpp"
5 
7 
8 void test (const char *address)
9 {
10  // Create a router
11  void *router = test_context_socket (ZMQ_ROUTER);
13 
14  // set router socket options
16 
17  // bind router
19 
20  // Create a dealer
21  void *dealer = test_context_socket (ZMQ_DEALER);
23 
24  // Receive the hello message
25  recv_string_expect_success (dealer, "H", 0);
26 
27  // Clean up.
30 }
31 
32 void test_tcp ()
33 {
34  test ("tcp://127.0.0.1:*");
35 }
36 
37 void test_inproc ()
38 {
39  test ("inproc://hello-msg");
40 }
41 
43 {
44  char address[] = "inproc://late-hello-msg";
45 
46  // Create a server
48 
49  // set server socket options
51 
52  // Create a dealer
56 
57  // bind server after the dealer
59 
60  // Receive the welcome message from server
62 
63  // Receive the hello message from client
65 
66  // Clean up.
69 }
70 
71 int main ()
72 {
74 
75  UNITY_BEGIN ();
79  return UNITY_END ();
80 }
ZMQ_SERVER
#define ZMQ_SERVER
Definition: zmq_draft.h:14
UNITY_END
return UNITY_END()
ZMQ_CLIENT
#define ZMQ_CLIENT
Definition: zmq_draft.h:15
RUN_TEST
#define RUN_TEST(func)
Definition: unity_internals.h:615
test_tcp
void test_tcp()
Definition: test_hello_msg.cpp:32
SETUP_TEARDOWN_TESTCONTEXT
#define SETUP_TEARDOWN_TESTCONTEXT
Definition: testutil_unity.hpp:172
client
void client(int num)
Definition: test_multithread.cpp:134
address
const char * address
Definition: builds/zos/test_fork.cpp:6
zmq_connect
ZMQ_EXPORT int zmq_connect(void *s_, const char *addr_)
Definition: zmq.cpp:307
testutil_unity.hpp
test_inproc_late_bind
void test_inproc_late_bind()
Definition: test_hello_msg.cpp:42
ZMQ_DEALER
#define ZMQ_DEALER
Definition: zmq.h:263
zmq_setsockopt
ZMQ_EXPORT int zmq_setsockopt(void *s_, int option_, const void *optval_, size_t optvallen_)
Definition: zmq.cpp:250
testutil.hpp
ZMQ_ROUTER
#define ZMQ_ROUTER
Definition: zmq.h:264
ZMQ_HELLO_MSG
#define ZMQ_HELLO_MSG
Definition: zmq_draft.h:42
my_endpoint
char my_endpoint[MAX_SOCKET_STRING]
Definition: test_security_curve.cpp:31
MAX_SOCKET_STRING
#define MAX_SOCKET_STRING
Definition: libzmq/tests/testutil.hpp:35
zmq_bind
ZMQ_EXPORT int zmq_bind(void *s_, const char *addr_)
Definition: zmq.cpp:299
test_context_socket
void * test_context_socket(int type_)
Definition: testutil_unity.cpp:200
server
void * server
Definition: test_security_curve.cpp:29
recv_string_expect_success
void recv_string_expect_success(void *socket_, const char *str_, int flags_)
Definition: testutil_unity.cpp:101
setup_test_environment
void setup_test_environment(int timeout_seconds_)
Definition: testutil.cpp:201
UNITY_BEGIN
UNITY_BEGIN()
test
SETUP_TEARDOWN_TESTCONTEXT void test(const char *address)
Definition: test_hello_msg.cpp:8
main
int main()
Definition: test_hello_msg.cpp:71
test_context_socket_close
void * test_context_socket_close(void *socket_)
Definition: testutil_unity.cpp:208
TEST_ASSERT_SUCCESS_ERRNO
#define TEST_ASSERT_SUCCESS_ERRNO(expr)
Definition: proxy_thr.cpp:47
test_inproc
void test_inproc()
Definition: test_hello_msg.cpp:37
test_bind
void test_bind(void *socket_, const char *bind_address_, char *my_endpoint_, size_t len_)
Definition: testutil_unity.cpp:223


libaditof
Author(s):
autogenerated on Wed May 21 2025 02:06:59