test_reqrep_ipc.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 
6 #include <stdlib.h>
7 
9 
10 void test_leak ()
11 {
12  char my_endpoint[256];
13 
14  void *sb = test_context_socket (ZMQ_REP);
16 
17  void *sc = test_context_socket (ZMQ_REQ);
19 
20  static const char leakymsg[] = "leakymsg";
21  send_string_expect_success (sc, leakymsg, 0);
22 
23  char *buf = s_recv (sb);
24  free (buf);
25 
27 
29 
30  send_string_expect_success (sb, leakymsg, 0);
31 
33 }
34 
35 void test_simple (void)
36 {
37  char my_endpoint[256];
38 
39  void *sb = test_context_socket (ZMQ_REP);
41 
42  void *sc = test_context_socket (ZMQ_REQ);
44 
45  bounce (sb, sc);
46 
49 }
50 
51 int main (void)
52 {
54 
55  UNITY_BEGIN ();
58  return UNITY_END ();
59 }
bounce
static void bounce(void *socket_)
Definition: test_req_relaxed.cpp:50
UNITY_END
return UNITY_END()
msleep
void msleep(int milliseconds_)
Definition: testutil.cpp:227
RUN_TEST
#define RUN_TEST(func)
Definition: unity_internals.h:615
SETUP_TEARDOWN_TESTCONTEXT
#define SETUP_TEARDOWN_TESTCONTEXT
Definition: testutil_unity.hpp:172
s_recv
char * s_recv(void *socket_)
Definition: testutil.cpp:123
ZMQ_REQ
#define ZMQ_REQ
Definition: zmq.h:261
zmq_connect
ZMQ_EXPORT int zmq_connect(void *s_, const char *addr_)
Definition: zmq.cpp:307
testutil_unity.hpp
test_leak
SETUP_TEARDOWN_TESTCONTEXT void test_leak()
Definition: test_reqrep_ipc.cpp:10
bind_loopback_ipc
void bind_loopback_ipc(void *socket_, char *my_endpoint_, size_t len_)
Definition: testutil_unity.cpp:256
sb
void * sb
Definition: test_channel.cpp:8
testutil.hpp
ZMQ_REP
#define ZMQ_REP
Definition: zmq.h:262
my_endpoint
char my_endpoint[MAX_SOCKET_STRING]
Definition: test_security_curve.cpp:31
sc
void * sc
Definition: test_channel.cpp:9
test_context_socket
void * test_context_socket(int type_)
Definition: testutil_unity.cpp:200
SETTLE_TIME
#define SETTLE_TIME
Definition: libzmq/tests/testutil.hpp:31
buf
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glcorearb.h:4175
send_string_expect_success
void send_string_expect_success(void *socket_, const char *str_, int flags_)
Definition: testutil_unity.cpp:94
main
int main(void)
Definition: test_reqrep_ipc.cpp:51
test_simple
void test_simple(void)
Definition: test_reqrep_ipc.cpp:35
setup_test_environment
void setup_test_environment(int timeout_seconds_)
Definition: testutil.cpp:201
UNITY_BEGIN
UNITY_BEGIN()
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