Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
L
libzmq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
libzmq
Commits
fce18385
Commit
fce18385
authored
Aug 20, 2018
by
Simon Giesecke
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Problem: test_pair_tcp not yet using unity
Solution: migrate to unity
parent
d7e51cdf
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
26 deletions
+36
-26
Makefile.am
Makefile.am
+2
-1
test_pair_tcp.cpp
tests/test_pair_tcp.cpp
+34
-25
No files found.
Makefile.am
View file @
fce18385
...
...
@@ -468,7 +468,8 @@ tests_test_pair_inproc_LDADD = src/libzmq.la
tests_test_pair_tcp_SOURCES
=
\
tests/test_pair_tcp.cpp
\
tests/testutil.hpp
tests_test_pair_tcp_LDADD
=
src/libzmq.la
tests_test_pair_tcp_LDADD
=
src/libzmq.la
${
UNITY_LIBS
}
tests_test_pair_tcp_CPPFLAGS
=
${
UNITY_CPPFLAGS
}
tests_test_reqrep_inproc_SOURCES
=
\
tests/test_reqrep_inproc.cpp
\
...
...
tests/test_pair_tcp.cpp
View file @
fce18385
...
...
@@ -28,6 +28,18 @@
*/
#include "testutil.hpp"
#include "testutil_unity.hpp"
void
setUp
()
{
setup_test_context
();
}
void
tearDown
()
{
teardown_test_context
();
}
typedef
void
(
*
extra_func_t
)
(
void
*
socket_
);
...
...
@@ -43,50 +55,47 @@ void set_sockopt_fastpath (void *socket)
void
test_pair_tcp
(
extra_func_t
extra_func_
=
NULL
)
{
size_t
len
=
MAX_SOCKET_STRING
;
char
my_endpoint
[
MAX_SOCKET_STRING
];
void
*
ctx
=
zmq_ctx_new
();
assert
(
ctx
);
void
*
sb
=
zmq_socket
(
ctx
,
ZMQ_PAIR
);
assert
(
sb
);
void
*
sb
=
test_context_socket
(
ZMQ_PAIR
);
if
(
extra_func_
)
extra_func_
(
sb
);
int
rc
=
zmq_bind
(
sb
,
"tcp://127.0.0.1:*"
);
assert
(
rc
==
0
);
rc
=
zmq_getsockopt
(
sb
,
ZMQ_LAST_ENDPOINT
,
my_endpoint
,
&
len
);
assert
(
rc
==
0
);
char
my_endpoint
[
MAX_SOCKET_STRING
];
bind_loopback_ipv4
(
sb
,
my_endpoint
,
sizeof
my_endpoint
);
void
*
sc
=
zmq_socket
(
ctx
,
ZMQ_PAIR
);
assert
(
sc
);
void
*
sc
=
test_context_socket
(
ZMQ_PAIR
);
if
(
extra_func_
)
extra_func_
(
sc
);
rc
=
zmq_connect
(
sc
,
my_endpoint
);
assert
(
rc
==
0
);
TEST_ASSERT_SUCCESS_ERRNO
(
zmq_connect
(
sc
,
my_endpoint
));
bounce
(
sb
,
sc
);
rc
=
zmq_close
(
sc
);
assert
(
rc
==
0
);
test_context_socket_close
(
sc
);
test_context_socket_close
(
sb
);
}
rc
=
zmq_close
(
sb
);
assert
(
rc
==
0
);
void
test_pair_tcp_regular
()
{
test_pair_tcp
();
}
rc
=
zmq_ctx_term
(
ctx
);
assert
(
rc
==
0
);
#ifdef ZMQ_BUILD_DRAFT
void
test_pair_tcp_fastpath
()
{
test_pair_tcp
(
set_sockopt_fastpath
);
}
#endif
int
main
(
void
)
int
main
()
{
setup_test_environment
();
test_pair_tcp
();
UNITY_BEGIN
();
RUN_TEST
(
test_pair_tcp_regular
);
#ifdef ZMQ_BUILD_DRAFT
test_pair_tcp
(
set_sockopt
_fastpath
);
RUN_TEST
(
test_pair_tcp
_fastpath
);
#endif
return
0
;
return
UNITY_END
()
;
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment