test_conflate.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_conflate ()
9 {
11 
12  int rc;
13 
14  void *s_in = test_context_socket (ZMQ_PULL);
15 
16  int conflate = 1;
18  zmq_setsockopt (s_in, ZMQ_CONFLATE, &conflate, sizeof (conflate)));
20 
21  void *s_out = test_context_socket (ZMQ_PUSH);
22 
24 
25  int message_count = 20;
26  for (int j = 0; j < message_count; ++j) {
28  zmq_send (s_out, (void *) &j, sizeof (int), 0));
29  }
31 
32  int payload_recved = 0;
34  zmq_recv (s_in, (void *) &payload_recved, sizeof (int), 0));
36  TEST_ASSERT_EQUAL_INT (message_count - 1, payload_recved);
37 
40 }
41 
42 int main (int, char *[])
43 {
45 
46  UNITY_BEGIN ();
48  return UNITY_END ();
49 }
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
bind_loopback_ipv4
void bind_loopback_ipv4(void *socket_, char *my_endpoint_, size_t len_)
Definition: testutil_unity.cpp:246
zmq_connect
ZMQ_EXPORT int zmq_connect(void *s_, const char *addr_)
Definition: zmq.cpp:307
TEST_ASSERT_GREATER_THAN_INT
#define TEST_ASSERT_GREATER_THAN_INT(threshold, actual)
Definition: unity.h:153
testutil_unity.hpp
zmq_setsockopt
ZMQ_EXPORT int zmq_setsockopt(void *s_, int option_, const void *optval_, size_t optvallen_)
Definition: zmq.cpp:250
ZMQ_PUSH
#define ZMQ_PUSH
Definition: zmq.h:266
testutil.hpp
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
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
TEST_ASSERT_EQUAL_INT
#define TEST_ASSERT_EQUAL_INT(expected, actual)
Definition: unity.h:128
main
int main(int, char *[])
Definition: test_conflate.cpp:42
zmq_recv
ZMQ_EXPORT int zmq_recv(void *s_, void *buf_, size_t len_, int flags_)
Definition: zmq.cpp:487
test_conflate
SETUP_TEARDOWN_TESTCONTEXT void test_conflate()
Definition: test_conflate.cpp:8
setup_test_environment
void setup_test_environment(int timeout_seconds_)
Definition: testutil.cpp:201
UNITY_BEGIN
UNITY_BEGIN()
zmq_send
ZMQ_EXPORT int zmq_send(void *s_, const void *buf_, size_t len_, int flags_)
Definition: zmq.cpp:377
ZMQ_PULL
#define ZMQ_PULL
Definition: zmq.h:265
message_count
static int message_count
Definition: inproc_thr.cpp:18
test_context_socket_close
void * test_context_socket_close(void *socket_)
Definition: testutil_unity.cpp:208
ZMQ_CONFLATE
#define ZMQ_CONFLATE
Definition: zmq.h:319
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