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
873abdd2
Commit
873abdd2
authored
Apr 24, 2012
by
Martin Hurton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename XREP/XREQ to ROUTER/DEALER in tests
parent
016df8e8
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
30 additions
and
30 deletions
+30
-30
test_invalid_rep.cpp
tests/test_invalid_rep.cpp
+13
-13
test_last_endpoint.cpp
tests/test_last_endpoint.cpp
+1
-1
test_msg_flags.cpp
tests/test_msg_flags.cpp
+2
-2
test_reqrep_device.cpp
tests/test_reqrep_device.cpp
+14
-14
No files found.
tests/test_invalid_rep.cpp
View file @
873abdd2
...
...
@@ -27,19 +27,19 @@ int main (int argc, char *argv [])
{
fprintf
(
stderr
,
"test_invalid_rep running...
\n
"
);
// Create REQ/
XREP
wiring.
// Create REQ/
ROUTER
wiring.
void
*
ctx
=
zmq_init
(
1
);
assert
(
ctx
);
void
*
xrep_socket
=
zmq_socket
(
ctx
,
ZMQ_XREP
);
assert
(
xrep
_socket
);
void
*
router_socket
=
zmq_socket
(
ctx
,
ZMQ_ROUTER
);
assert
(
router
_socket
);
void
*
req_socket
=
zmq_socket
(
ctx
,
ZMQ_REQ
);
assert
(
req_socket
);
int
linger
=
0
;
int
rc
=
zmq_setsockopt
(
xrep
_socket
,
ZMQ_LINGER
,
&
linger
,
sizeof
(
int
));
int
rc
=
zmq_setsockopt
(
router
_socket
,
ZMQ_LINGER
,
&
linger
,
sizeof
(
int
));
assert
(
rc
==
0
);
rc
=
zmq_setsockopt
(
req_socket
,
ZMQ_LINGER
,
&
linger
,
sizeof
(
int
));
assert
(
rc
==
0
);
rc
=
zmq_bind
(
xrep
_socket
,
"inproc://hi"
);
rc
=
zmq_bind
(
router
_socket
,
"inproc://hi"
);
assert
(
rc
==
0
);
rc
=
zmq_connect
(
req_socket
,
"inproc://hi"
);
assert
(
rc
==
0
);
...
...
@@ -53,23 +53,23 @@ int main (int argc, char *argv [])
int
addr_size
;
char
bottom
[
1
];
char
body
[
1
];
addr_size
=
zmq_recv
(
xrep
_socket
,
addr
,
sizeof
(
addr
),
0
);
addr_size
=
zmq_recv
(
router
_socket
,
addr
,
sizeof
(
addr
),
0
);
assert
(
addr_size
>=
0
);
rc
=
zmq_recv
(
xrep
_socket
,
bottom
,
sizeof
(
bottom
),
0
);
rc
=
zmq_recv
(
router
_socket
,
bottom
,
sizeof
(
bottom
),
0
);
assert
(
rc
==
0
);
rc
=
zmq_recv
(
xrep
_socket
,
body
,
sizeof
(
body
),
0
);
rc
=
zmq_recv
(
router
_socket
,
body
,
sizeof
(
body
),
0
);
assert
(
rc
==
1
);
// Send invalid reply.
rc
=
zmq_send
(
xrep
_socket
,
addr
,
addr_size
,
0
);
rc
=
zmq_send
(
router
_socket
,
addr
,
addr_size
,
0
);
assert
(
rc
==
addr_size
);
// Send valid reply.
rc
=
zmq_send
(
xrep
_socket
,
addr
,
addr_size
,
ZMQ_SNDMORE
);
rc
=
zmq_send
(
router
_socket
,
addr
,
addr_size
,
ZMQ_SNDMORE
);
assert
(
rc
==
addr_size
);
rc
=
zmq_send
(
xrep
_socket
,
bottom
,
0
,
ZMQ_SNDMORE
);
rc
=
zmq_send
(
router
_socket
,
bottom
,
0
,
ZMQ_SNDMORE
);
assert
(
rc
==
0
);
rc
=
zmq_send
(
xrep
_socket
,
"b"
,
1
,
0
);
rc
=
zmq_send
(
router
_socket
,
"b"
,
1
,
0
);
assert
(
rc
==
1
);
// Check whether we've got the valid reply.
...
...
@@ -78,7 +78,7 @@ int main (int argc, char *argv [])
assert
(
body
[
0
]
==
'b'
);
// Tear down the wiring.
rc
=
zmq_close
(
xrep
_socket
);
rc
=
zmq_close
(
router
_socket
);
assert
(
rc
==
0
);
rc
=
zmq_close
(
req_socket
);
assert
(
rc
==
0
);
...
...
tests/test_last_endpoint.cpp
View file @
873abdd2
...
...
@@ -41,7 +41,7 @@ int main (int argc, char *argv [])
void
*
ctx
=
zmq_init
(
1
);
assert
(
ctx
);
void
*
sb
=
zmq_socket
(
ctx
,
ZMQ_
XREP
);
void
*
sb
=
zmq_socket
(
ctx
,
ZMQ_
ROUTER
);
assert
(
sb
);
do_bind_and_verify
(
sb
,
"tcp://127.0.0.1:5560"
);
...
...
tests/test_msg_flags.cpp
View file @
873abdd2
...
...
@@ -29,11 +29,11 @@ int main (int argc, char *argv [])
// Create the infrastructure
void
*
ctx
=
zmq_init
(
0
);
assert
(
ctx
);
void
*
sb
=
zmq_socket
(
ctx
,
ZMQ_
XREP
);
void
*
sb
=
zmq_socket
(
ctx
,
ZMQ_
ROUTER
);
assert
(
sb
);
int
rc
=
zmq_bind
(
sb
,
"inproc://a"
);
assert
(
rc
==
0
);
void
*
sc
=
zmq_socket
(
ctx
,
ZMQ_
XREQ
);
void
*
sc
=
zmq_socket
(
ctx
,
ZMQ_
DEALER
);
assert
(
sc
);
rc
=
zmq_connect
(
sc
,
"inproc://a"
);
assert
(
rc
==
0
);
...
...
tests/test_reqrep_device.cpp
View file @
873abdd2
...
...
@@ -33,13 +33,13 @@ int main (int argc, char *argv [])
assert
(
ctx
);
// Create a req/rep device.
void
*
xreq
=
zmq_socket
(
ctx
,
ZMQ_XREQ
);
assert
(
xreq
);
int
rc
=
zmq_bind
(
xreq
,
"tcp://127.0.0.1:5560"
);
void
*
dealer
=
zmq_socket
(
ctx
,
ZMQ_DEALER
);
assert
(
dealer
);
int
rc
=
zmq_bind
(
dealer
,
"tcp://127.0.0.1:5560"
);
assert
(
rc
==
0
);
void
*
xrep
=
zmq_socket
(
ctx
,
ZMQ_XREP
);
assert
(
xrep
);
rc
=
zmq_bind
(
xrep
,
"tcp://127.0.0.1:5561"
);
void
*
router
=
zmq_socket
(
ctx
,
ZMQ_ROUTER
);
assert
(
router
);
rc
=
zmq_bind
(
router
,
"tcp://127.0.0.1:5561"
);
assert
(
rc
==
0
);
// Create a worker.
...
...
@@ -65,13 +65,13 @@ int main (int argc, char *argv [])
zmq_msg_t
msg
;
rc
=
zmq_msg_init
(
&
msg
);
assert
(
rc
==
0
);
rc
=
zmq_recvmsg
(
xrep
,
&
msg
,
0
);
rc
=
zmq_recvmsg
(
router
,
&
msg
,
0
);
assert
(
rc
>=
0
);
int
rcvmore
;
size_t
sz
=
sizeof
(
rcvmore
);
rc
=
zmq_getsockopt
(
xrep
,
ZMQ_RCVMORE
,
&
rcvmore
,
&
sz
);
rc
=
zmq_getsockopt
(
router
,
ZMQ_RCVMORE
,
&
rcvmore
,
&
sz
);
assert
(
rc
==
0
);
rc
=
zmq_sendmsg
(
xreq
,
&
msg
,
rcvmore
?
ZMQ_SNDMORE
:
0
);
rc
=
zmq_sendmsg
(
dealer
,
&
msg
,
rcvmore
?
ZMQ_SNDMORE
:
0
);
assert
(
rc
>=
0
);
}
...
...
@@ -103,12 +103,12 @@ int main (int argc, char *argv [])
zmq_msg_t
msg
;
rc
=
zmq_msg_init
(
&
msg
);
assert
(
rc
==
0
);
rc
=
zmq_recvmsg
(
xreq
,
&
msg
,
0
);
rc
=
zmq_recvmsg
(
dealer
,
&
msg
,
0
);
assert
(
rc
>=
0
);
int
rcvmore
;
rc
=
zmq_getsockopt
(
xreq
,
ZMQ_RCVMORE
,
&
rcvmore
,
&
sz
);
rc
=
zmq_getsockopt
(
dealer
,
ZMQ_RCVMORE
,
&
rcvmore
,
&
sz
);
assert
(
rc
==
0
);
rc
=
zmq_sendmsg
(
xrep
,
&
msg
,
rcvmore
?
ZMQ_SNDMORE
:
0
);
rc
=
zmq_sendmsg
(
router
,
&
msg
,
rcvmore
?
ZMQ_SNDMORE
:
0
);
assert
(
rc
>=
0
);
}
...
...
@@ -131,9 +131,9 @@ int main (int argc, char *argv [])
assert
(
rc
==
0
);
rc
=
zmq_close
(
rep
);
assert
(
rc
==
0
);
rc
=
zmq_close
(
xrep
);
rc
=
zmq_close
(
router
);
assert
(
rc
==
0
);
rc
=
zmq_close
(
xreq
);
rc
=
zmq_close
(
dealer
);
assert
(
rc
==
0
);
rc
=
zmq_term
(
ctx
);
assert
(
rc
==
0
);
...
...
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