test_channel.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 <unity.h>
7 
8 void *sb;
9 void *sc;
10 
11 void setUp ()
12 {
14 
16  TEST_ASSERT_SUCCESS_ERRNO (zmq_bind (sb, "inproc://a"));
17 
19  TEST_ASSERT_SUCCESS_ERRNO (zmq_connect (sc, "inproc://a"));
20 }
21 
22 void tearDown ()
23 {
26 
28 }
29 
31 {
32  send_string_expect_success (sb, "HELLO", 0);
33  recv_string_expect_success (sc, "HELLO", 0);
34 
35  send_string_expect_success (sc, "WORLD", 0);
36  recv_string_expect_success (sb, "WORLD", 0);
37 }
38 
40 {
41  int rc = zmq_send (sc, "X", 1, ZMQ_SNDMORE);
42  TEST_ASSERT_EQUAL_INT (-1, rc);
44 }
45 
46 int main ()
47 {
49 
50  UNITY_BEGIN ();
53  return UNITY_END ();
54 }
UNITY_END
return UNITY_END()
tearDown
void tearDown()
Definition: test_channel.cpp:22
EINVAL
#define EINVAL
Definition: errno.hpp:25
RUN_TEST
#define RUN_TEST(func)
Definition: unity_internals.h:615
setup_test_context
void setup_test_context()
Definition: testutil_unity.cpp:179
errno
int errno
teardown_test_context
void teardown_test_context()
Definition: testutil_unity.cpp:189
zmq_connect
ZMQ_EXPORT int zmq_connect(void *s_, const char *addr_)
Definition: zmq.cpp:307
setUp
void setUp()
Definition: test_channel.cpp:11
testutil_unity.hpp
ZMQ_CHANNEL
#define ZMQ_CHANNEL
Definition: zmq_draft.h:22
sb
void * sb
Definition: test_channel.cpp:8
testutil.hpp
zmq_bind
ZMQ_EXPORT int zmq_bind(void *s_, const char *addr_)
Definition: zmq.cpp:299
main
int main()
Definition: test_channel.cpp:46
sc
void * sc
Definition: test_channel.cpp:9
test_context_socket
void * test_context_socket(int type_)
Definition: testutil_unity.cpp:200
TEST_ASSERT_EQUAL_INT
#define TEST_ASSERT_EQUAL_INT(expected, actual)
Definition: unity.h:128
unity.h
send_string_expect_success
void send_string_expect_success(void *socket_, const char *str_, int flags_)
Definition: testutil_unity.cpp:94
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()
ZMQ_SNDMORE
#define ZMQ_SNDMORE
Definition: zmq.h:359
test_roundtrip
void test_roundtrip()
Definition: test_channel.cpp:30
zmq_send
ZMQ_EXPORT int zmq_send(void *s_, const void *buf_, size_t len_, int flags_)
Definition: zmq.cpp:377
test_sndmore_fails
void test_sndmore_fails()
Definition: test_channel.cpp:39
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