test_reconnect_ivl.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_reconnect_ivl_against_pair_socket (const char *my_endpoint_,
9  void *sb_)
10 {
12  int interval = -1;
14  zmq_setsockopt (sc, ZMQ_RECONNECT_IVL, &interval, sizeof (int)));
15  TEST_ASSERT_SUCCESS_ERRNO (zmq_connect (sc, my_endpoint_));
16 
17  bounce (sb_, sc);
18 
19  TEST_ASSERT_SUCCESS_ERRNO (zmq_unbind (sb_, my_endpoint_));
20 
21  expect_bounce_fail (sb_, sc);
22 
23  TEST_ASSERT_SUCCESS_ERRNO (zmq_bind (sb_, my_endpoint_));
24 
25  expect_bounce_fail (sb_, sc);
26 
27  TEST_ASSERT_SUCCESS_ERRNO (zmq_connect (sc, my_endpoint_));
28 
29  bounce (sb_, sc);
30 
32 }
33 
34 #if defined(ZMQ_HAVE_IPC) && !defined(ZMQ_HAVE_GNU)
35 void test_reconnect_ivl_ipc (void)
36 {
37  char my_endpoint[256];
38  make_random_ipc_endpoint (my_endpoint);
39 
42 
45 }
46 #endif
47 
49 {
51 
53  bind_function_ (sb, my_endpoint, sizeof my_endpoint);
54 
57 }
58 
60 {
62 }
63 
65 {
66  if (is_ipv6_available ()) {
69  }
70 }
71 
72 int main (void)
73 {
75 
76  UNITY_BEGIN ();
77 #if defined(ZMQ_HAVE_IPC) && !defined(ZMQ_HAVE_GNU)
78  RUN_TEST (test_reconnect_ivl_ipc);
79 #endif
82 
83  return UNITY_END ();
84 }
bounce
static void bounce(void *socket_)
Definition: test_req_relaxed.cpp:50
zmq_ctx_set
ZMQ_EXPORT int zmq_ctx_set(void *context_, int option_, int optval_)
Definition: zmq.cpp:156
test_reconnect_ivl_tcp
void test_reconnect_ivl_tcp(bind_function_t bind_function_)
Definition: test_reconnect_ivl.cpp:48
test_reconnect_ivl_against_pair_socket
SETUP_TEARDOWN_TESTCONTEXT void test_reconnect_ivl_against_pair_socket(const char *my_endpoint_, void *sb_)
Definition: test_reconnect_ivl.cpp:8
UNITY_END
return UNITY_END()
zmq_unbind
ZMQ_EXPORT int zmq_unbind(void *s_, const char *addr_)
Definition: zmq.cpp:337
is_ipv6_available
int is_ipv6_available()
Definition: testutil.cpp:236
RUN_TEST
#define RUN_TEST(func)
Definition: unity_internals.h:615
main
int main(void)
Definition: test_reconnect_ivl.cpp:72
SETUP_TEARDOWN_TESTCONTEXT
#define SETUP_TEARDOWN_TESTCONTEXT
Definition: testutil_unity.hpp:172
bind_loopback_ipv4
void bind_loopback_ipv4(void *socket_, char *my_endpoint_, size_t len_)
Definition: testutil_unity.cpp:246
get_test_context
void * get_test_context()
Definition: testutil_unity.cpp:184
zmq_connect
ZMQ_EXPORT int zmq_connect(void *s_, const char *addr_)
Definition: zmq.cpp:307
testutil_unity.hpp
zmq_setsockopt
ZMQ_EXPORT int zmq_setsockopt(void *s_, int option_, const void *optval_, size_t optvallen_)
Definition: zmq.cpp:250
sb
void * sb
Definition: test_channel.cpp:8
testutil.hpp
bind_function_t
void(* bind_function_t)(void *socket_, char *my_endpoint_, size_t len_)
Definition: testutil_unity.hpp:236
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
sc
void * sc
Definition: test_channel.cpp:9
test_context_socket
void * test_context_socket(int type_)
Definition: testutil_unity.cpp:200
bind_loopback_ipv6
void bind_loopback_ipv6(void *socket_, char *my_endpoint_, size_t len_)
Definition: testutil_unity.cpp:251
expect_bounce_fail
void expect_bounce_fail(void *server_, void *client_)
Definition: testutil.cpp:107
ZMQ_PAIR
#define ZMQ_PAIR
Definition: zmq.h:258
test_reconnect_ivl_tcp_ipv4
void test_reconnect_ivl_tcp_ipv4()
Definition: test_reconnect_ivl.cpp:59
ZMQ_IPV6
#define ZMQ_IPV6
Definition: zmq.h:307
setup_test_environment
void setup_test_environment(int timeout_seconds_)
Definition: testutil.cpp:201
UNITY_BEGIN
UNITY_BEGIN()
test_reconnect_ivl_tcp_ipv6
void test_reconnect_ivl_tcp_ipv6()
Definition: test_reconnect_ivl.cpp:64
ZMQ_RECONNECT_IVL
#define ZMQ_RECONNECT_IVL
Definition: zmq.h:289
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


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