summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMartin Sustrik <sustrik@250bpm.com>2012-02-16 10:01:47 +0900
committerMartin Sustrik <sustrik@250bpm.com>2012-02-16 10:01:47 +0900
commit4a7aad06d95701cf232198093ce396dcdbb53e5b (patch)
tree8ced8929e603a179d9434099244dfd782e705d5e /tests
parent1fc63e4dbcf1438eb571d720f57be68852f820f7 (diff)
ZeroMQ renamed to Crossroads
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/Makefile.am2
-rw-r--r--tests/test_hwm.cpp36
-rw-r--r--tests/test_invalid_rep.cpp48
-rw-r--r--tests/test_msg_flags.cpp44
-rw-r--r--tests/test_pair_inproc.cpp22
-rw-r--r--tests/test_pair_ipc.cpp24
-rw-r--r--tests/test_pair_tcp.cpp24
-rw-r--r--tests/test_reqrep_device.cpp82
-rw-r--r--tests/test_reqrep_inproc.cpp24
-rw-r--r--tests/test_reqrep_ipc.cpp24
-rw-r--r--tests/test_reqrep_tcp.cpp24
-rw-r--r--tests/test_shutdown_stress.cpp26
-rw-r--r--tests/test_sub_forward.cpp56
-rw-r--r--tests/test_timeo.cpp70
-rw-r--r--tests/testutil.hpp38
15 files changed, 272 insertions, 272 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am
index fb0c6f8..06830e2 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -1,7 +1,7 @@
INCLUDES = -I$(top_builddir)/include \
-I$(top_srcdir)/include
-LDADD = $(top_builddir)/src/libzmq.la
+LDADD = $(top_builddir)/src/libxs.la
noinst_PROGRAMS = test_pair_inproc \
test_pair_tcp \
diff --git a/tests/test_hwm.cpp b/tests/test_hwm.cpp
index d887b31..a1db711 100644
--- a/tests/test_hwm.cpp
+++ b/tests/test_hwm.cpp
@@ -1,15 +1,15 @@
/*
- Copyright (c) 2010-2011 250bpm s.r.o.
+ Copyright (c) 2010-2012 250bpm s.r.o.
Copyright (c) 2010-2011 Other contributors as noted in the AUTHORS file
- This file is part of 0MQ.
+ This file is part of Crossroads project.
- 0MQ is free software; you can redistribute it and/or modify it under
+ Crossroads is free software; you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
- 0MQ is distributed in the hope that it will be useful,
+ Crossroads is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
@@ -28,30 +28,30 @@ int main (int argc, char *argv [])
{
fprintf (stderr, "test_hwm running...\n");
- void *ctx = zmq_init (1);
+ void *ctx = xs_init (1);
assert (ctx);
// Create pair of socket, each with high watermark of 2. Thus the total
// buffer space should be 4 messages.
- void *sb = zmq_socket (ctx, ZMQ_PULL);
+ void *sb = xs_socket (ctx, XS_PULL);
assert (sb);
int hwm = 2;
- int rc = zmq_setsockopt (sb, ZMQ_RCVHWM, &hwm, sizeof (hwm));
+ int rc = xs_setsockopt (sb, XS_RCVHWM, &hwm, sizeof (hwm));
assert (rc == 0);
- rc = zmq_bind (sb, "inproc://a");
+ rc = xs_bind (sb, "inproc://a");
assert (rc == 0);
- void *sc = zmq_socket (ctx, ZMQ_PUSH);
+ void *sc = xs_socket (ctx, XS_PUSH);
assert (sc);
- rc = zmq_setsockopt (sc, ZMQ_SNDHWM, &hwm, sizeof (hwm));
+ rc = xs_setsockopt (sc, XS_SNDHWM, &hwm, sizeof (hwm));
assert (rc == 0);
- rc = zmq_connect (sc, "inproc://a");
+ rc = xs_connect (sc, "inproc://a");
assert (rc == 0);
// Try to send 10 messages. Only 4 should succeed.
for (int i = 0; i < 10; i++)
{
- int rc = zmq_send (sc, NULL, 0, ZMQ_DONTWAIT);
+ int rc = xs_send (sc, NULL, 0, XS_DONTWAIT);
if (i < 4)
assert (rc == 0);
else
@@ -60,25 +60,25 @@ int main (int argc, char *argv [])
// There should be now 4 messages pending, consume them.
for (int i = 0; i != 4; i++) {
- rc = zmq_recv (sb, NULL, 0, 0);
+ rc = xs_recv (sb, NULL, 0, 0);
assert (rc == 0);
}
// Now it should be possible to send one more.
- rc = zmq_send (sc, NULL, 0, 0);
+ rc = xs_send (sc, NULL, 0, 0);
assert (rc == 0);
// Consume the remaining message.
- rc = zmq_recv (sb, NULL, 0, 0);
+ rc = xs_recv (sb, NULL, 0, 0);
assert (rc == 0);
- rc = zmq_close (sc);
+ rc = xs_close (sc);
assert (rc == 0);
- rc = zmq_close (sb);
+ rc = xs_close (sb);
assert (rc == 0);
- rc = zmq_term (ctx);
+ rc = xs_term (ctx);
assert (rc == 0);
return 0;
diff --git a/tests/test_invalid_rep.cpp b/tests/test_invalid_rep.cpp
index 9c77cc4..9ed2145 100644
--- a/tests/test_invalid_rep.cpp
+++ b/tests/test_invalid_rep.cpp
@@ -1,16 +1,16 @@
/*
- Copyright (c) 2010-2011 250bpm s.r.o.
+ Copyright (c) 2010-2012 250bpm s.r.o.
Copyright (c) 2011 VMware, Inc.
Copyright (c) 2010-2011 Other contributors as noted in the AUTHORS file
- This file is part of 0MQ.
+ This file is part of Crossroads project.
- 0MQ is free software; you can redistribute it and/or modify it under
+ Crossroads is free software; you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
- 0MQ is distributed in the hope that it will be useful,
+ Crossroads is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
@@ -19,7 +19,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "../include/zmq.h"
+#include "../include/xs.h"
#include <assert.h>
#include <stdio.h>
@@ -28,24 +28,24 @@ int main (int argc, char *argv [])
fprintf (stderr, "test_invalid_rep running...\n");
// Create REQ/XREP wiring.
- void *ctx = zmq_init (1);
+ void *ctx = xs_init (1);
assert (ctx);
- void *xrep_socket = zmq_socket (ctx, ZMQ_XREP);
+ void *xrep_socket = xs_socket (ctx, XS_XREP);
assert (xrep_socket);
- void *req_socket = zmq_socket (ctx, ZMQ_REQ);
+ void *req_socket = xs_socket (ctx, XS_REQ);
assert (req_socket);
int linger = 0;
- int rc = zmq_setsockopt (xrep_socket, ZMQ_LINGER, &linger, sizeof (int));
+ int rc = xs_setsockopt (xrep_socket, XS_LINGER, &linger, sizeof (int));
assert (rc == 0);
- rc = zmq_setsockopt (req_socket, ZMQ_LINGER, &linger, sizeof (int));
+ rc = xs_setsockopt (req_socket, XS_LINGER, &linger, sizeof (int));
assert (rc == 0);
- rc = zmq_bind (xrep_socket, "inproc://hi");
+ rc = xs_bind (xrep_socket, "inproc://hi");
assert (rc == 0);
- rc = zmq_connect (req_socket, "inproc://hi");
+ rc = xs_connect (req_socket, "inproc://hi");
assert (rc == 0);
// Initial request.
- rc = zmq_send (req_socket, "r", 1, 0);
+ rc = xs_send (req_socket, "r", 1, 0);
assert (rc == 1);
// Receive the request.
@@ -53,36 +53,36 @@ 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 = xs_recv (xrep_socket, addr, sizeof (addr), 0);
assert (addr_size >= 0);
- rc = zmq_recv (xrep_socket, bottom, sizeof (bottom), 0);
+ rc = xs_recv (xrep_socket, bottom, sizeof (bottom), 0);
assert (rc == 0);
- rc = zmq_recv (xrep_socket, body, sizeof (body), 0);
+ rc = xs_recv (xrep_socket, body, sizeof (body), 0);
assert (rc == 1);
// Send invalid reply.
- rc = zmq_send (xrep_socket, addr, addr_size, 0);
+ rc = xs_send (xrep_socket, addr, addr_size, 0);
assert (rc == addr_size);
// Send valid reply.
- rc = zmq_send (xrep_socket, addr, addr_size, ZMQ_SNDMORE);
+ rc = xs_send (xrep_socket, addr, addr_size, XS_SNDMORE);
assert (rc == addr_size);
- rc = zmq_send (xrep_socket, bottom, 0, ZMQ_SNDMORE);
+ rc = xs_send (xrep_socket, bottom, 0, XS_SNDMORE);
assert (rc == 0);
- rc = zmq_send (xrep_socket, "b", 1, 0);
+ rc = xs_send (xrep_socket, "b", 1, 0);
assert (rc == 1);
// Check whether we've got the valid reply.
- rc = zmq_recv (req_socket, body, sizeof (body), 0);
+ rc = xs_recv (req_socket, body, sizeof (body), 0);
assert (rc == 1);
assert (body [0] == 'b');
// Tear down the wiring.
- rc = zmq_close (xrep_socket);
+ rc = xs_close (xrep_socket);
assert (rc == 0);
- rc = zmq_close (req_socket);
+ rc = xs_close (req_socket);
assert (rc == 0);
- rc = zmq_term (ctx);
+ rc = xs_term (ctx);
assert (rc == 0);
return 0;
diff --git a/tests/test_msg_flags.cpp b/tests/test_msg_flags.cpp
index f836184..535a7d5 100644
--- a/tests/test_msg_flags.cpp
+++ b/tests/test_msg_flags.cpp
@@ -2,14 +2,14 @@
Copyright (c) 2011-2012 250bpm s.r.o.
Copyright (c) 2011 Other contributors as noted in the AUTHORS file
- This file is part of 0MQ.
+ This file is part of Crossroads project.
- 0MQ is free software; you can redistribute it and/or modify it under
+ Crossroads is free software; you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
- 0MQ is distributed in the hope that it will be useful,
+ Crossroads is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
@@ -21,62 +21,62 @@
#include <assert.h>
#include <string.h>
-#include "../include/zmq.h"
+#include "../include/xs.h"
int main (int argc, char *argv [])
{
// Create the infrastructure
- void *ctx = zmq_init (1);
+ void *ctx = xs_init (1);
assert (ctx);
- void *sb = zmq_socket (ctx, ZMQ_XREP);
+ void *sb = xs_socket (ctx, XS_XREP);
assert (sb);
- int rc = zmq_bind (sb, "inproc://a");
+ int rc = xs_bind (sb, "inproc://a");
assert (rc == 0);
- void *sc = zmq_socket (ctx, ZMQ_XREQ);
+ void *sc = xs_socket (ctx, XS_XREQ);
assert (sc);
- rc = zmq_connect (sc, "inproc://a");
+ rc = xs_connect (sc, "inproc://a");
assert (rc == 0);
// Send 2-part message.
- rc = zmq_send (sc, "A", 1, ZMQ_SNDMORE);
+ rc = xs_send (sc, "A", 1, XS_SNDMORE);
assert (rc == 1);
- rc = zmq_send (sc, "B", 1, 0);
+ rc = xs_send (sc, "B", 1, 0);
assert (rc == 1);
// Identity comes first.
- zmq_msg_t msg;
- rc = zmq_msg_init (&msg);
+ xs_msg_t msg;
+ rc = xs_msg_init (&msg);
assert (rc == 0);
- rc = zmq_recvmsg (sb, &msg, 0);
+ rc = xs_recvmsg (sb, &msg, 0);
assert (rc >= 0);
int more;
size_t more_size = sizeof (more);
- rc = zmq_getmsgopt (&msg, ZMQ_MORE, &more, &more_size);
+ rc = xs_getmsgopt (&msg, XS_MORE, &more, &more_size);
assert (rc == 0);
assert (more == 1);
// Then the first part of the message body.
- rc = zmq_recvmsg (sb, &msg, 0);
+ rc = xs_recvmsg (sb, &msg, 0);
assert (rc == 1);
more_size = sizeof (more);
- rc = zmq_getmsgopt (&msg, ZMQ_MORE, &more, &more_size);
+ rc = xs_getmsgopt (&msg, XS_MORE, &more, &more_size);
assert (rc == 0);
assert (more == 1);
// And finally, the second part of the message body.
- rc = zmq_recvmsg (sb, &msg, 0);
+ rc = xs_recvmsg (sb, &msg, 0);
assert (rc == 1);
more_size = sizeof (more);
- rc = zmq_getmsgopt (&msg, ZMQ_MORE, &more, &more_size);
+ rc = xs_getmsgopt (&msg, XS_MORE, &more, &more_size);
assert (rc == 0);
assert (more == 0);
// Deallocate the infrastructure.
- rc = zmq_close (sc);
+ rc = xs_close (sc);
assert (rc == 0);
- rc = zmq_close (sb);
+ rc = xs_close (sb);
assert (rc == 0);
- rc = zmq_term (ctx);
+ rc = xs_term (ctx);
assert (rc == 0);
return 0 ;
}
diff --git a/tests/test_pair_inproc.cpp b/tests/test_pair_inproc.cpp
index 75a9720..d8f3726 100644
--- a/tests/test_pair_inproc.cpp
+++ b/tests/test_pair_inproc.cpp
@@ -2,14 +2,14 @@
Copyright (c) 2010-2012 250bpm s.r.o.
Copyright (c) 2010-2011 Other contributors as noted in the AUTHORS file
- This file is part of 0MQ.
+ This file is part of Crossroads project.
- 0MQ is free software; you can redistribute it and/or modify it under
+ Crossroads is free software; you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
- 0MQ is distributed in the hope that it will be useful,
+ Crossroads is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
@@ -26,28 +26,28 @@ int main (int argc, char *argv [])
{
fprintf (stderr, "test_pair_inproc running...\n");
- void *ctx = zmq_init (1);
+ void *ctx = xs_init (1);
assert (ctx);
- void *sb = zmq_socket (ctx, ZMQ_PAIR);
+ void *sb = xs_socket (ctx, XS_PAIR);
assert (sb);
- int rc = zmq_bind (sb, "inproc://a");
+ int rc = xs_bind (sb, "inproc://a");
assert (rc == 0);
- void *sc = zmq_socket (ctx, ZMQ_PAIR);
+ void *sc = xs_socket (ctx, XS_PAIR);
assert (sc);
- rc = zmq_connect (sc, "inproc://a");
+ rc = xs_connect (sc, "inproc://a");
assert (rc == 0);
bounce (sb, sc);
- rc = zmq_close (sc);
+ rc = xs_close (sc);
assert (rc == 0);
- rc = zmq_close (sb);
+ rc = xs_close (sb);
assert (rc == 0);
- rc = zmq_term (ctx);
+ rc = xs_term (ctx);
assert (rc == 0);
return 0 ;
diff --git a/tests/test_pair_ipc.cpp b/tests/test_pair_ipc.cpp
index 96a265f..5b9b536 100644
--- a/tests/test_pair_ipc.cpp
+++ b/tests/test_pair_ipc.cpp
@@ -1,15 +1,15 @@
/*
- Copyright (c) 2010-2011 250bpm s.r.o.
+ Copyright (c) 2010-2012 250bpm s.r.o.
Copyright (c) 2010-2011 Other contributors as noted in the AUTHORS file
- This file is part of 0MQ.
+ This file is part of Crossroads project.
- 0MQ is free software; you can redistribute it and/or modify it under
+ Crossroads is free software; you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
- 0MQ is distributed in the hope that it will be useful,
+ Crossroads is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
@@ -26,28 +26,28 @@ int main (int argc, char *argv [])
{
fprintf (stderr, "test_pair_ipc running...\n");
- void *ctx = zmq_init (1);
+ void *ctx = xs_init (1);
assert (ctx);
- void *sb = zmq_socket (ctx, ZMQ_PAIR);
+ void *sb = xs_socket (ctx, XS_PAIR);
assert (sb);
- int rc = zmq_bind (sb, "ipc:///tmp/tester");
+ int rc = xs_bind (sb, "ipc:///tmp/tester");
assert (rc == 0);
- void *sc = zmq_socket (ctx, ZMQ_PAIR);
+ void *sc = xs_socket (ctx, XS_PAIR);
assert (sc);
- rc = zmq_connect (sc, "ipc:///tmp/tester");
+ rc = xs_connect (sc, "ipc:///tmp/tester");
assert (rc == 0);
bounce (sb, sc);
- rc = zmq_close (sc);
+ rc = xs_close (sc);
assert (rc == 0);
- rc = zmq_close (sb);
+ rc = xs_close (sb);
assert (rc == 0);
- rc = zmq_term (ctx);
+ rc = xs_term (ctx);
assert (rc == 0);
return 0 ;
diff --git a/tests/test_pair_tcp.cpp b/tests/test_pair_tcp.cpp
index 464be5a..1c4bbf1 100644
--- a/tests/test_pair_tcp.cpp
+++ b/tests/test_pair_tcp.cpp
@@ -1,16 +1,16 @@
/*
- Copyright (c) 2010-2011 250bpm s.r.o.
+ Copyright (c) 2010-2012 250bpm s.r.o.
Copyright (c) 2011 iMatix Corporation
Copyright (c) 2010-2011 Other contributors as noted in the AUTHORS file
- This file is part of 0MQ.
+ This file is part of Crossroads project.
- 0MQ is free software; you can redistribute it and/or modify it under
+ Crossroads is free software; you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
- 0MQ is distributed in the hope that it will be useful,
+ Crossroads is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
@@ -27,28 +27,28 @@ int main (int argc, char *argv [])
{
fprintf (stderr, "test_pair_tcp running...\n");
- void *ctx = zmq_init (1);
+ void *ctx = xs_init (1);
assert (ctx);
- void *sb = zmq_socket (ctx, ZMQ_PAIR);
+ void *sb = xs_socket (ctx, XS_PAIR);
assert (sb);
- int rc = zmq_bind (sb, "tcp://127.0.0.1:5560");
+ int rc = xs_bind (sb, "tcp://127.0.0.1:5560");
assert (rc == 0);
- void *sc = zmq_socket (ctx, ZMQ_PAIR);
+ void *sc = xs_socket (ctx, XS_PAIR);
assert (sc);
- rc = zmq_connect (sc, "tcp://127.0.0.1:5560");
+ rc = xs_connect (sc, "tcp://127.0.0.1:5560");
assert (rc == 0);
bounce (sb, sc);
- rc = zmq_close (sc);
+ rc = xs_close (sc);
assert (rc == 0);
- rc = zmq_close (sb);
+ rc = xs_close (sb);
assert (rc == 0);
- rc = zmq_term (ctx);
+ rc = xs_term (ctx);
assert (rc == 0);
return 0 ;
diff --git a/tests/test_reqrep_device.cpp b/tests/test_reqrep_device.cpp
index d861cec..5571eed 100644
--- a/tests/test_reqrep_device.cpp
+++ b/tests/test_reqrep_device.cpp
@@ -1,16 +1,16 @@
/*
- Copyright (c) 2010-2011 250bpm s.r.o.
+ Copyright (c) 2010-2012 250bpm s.r.o.
Copyright (c) 2011 VMware, Inc.
Copyright (c) 2010-2011 Other contributors as noted in the AUTHORS file
- This file is part of 0MQ.
+ This file is part of Crossroads project.
- 0MQ is free software; you can redistribute it and/or modify it under
+ Crossroads is free software; you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
- 0MQ is distributed in the hope that it will be useful,
+ Crossroads is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
@@ -23,119 +23,119 @@
#include <string.h>
#include <stdio.h>
-#include "../include/zmq.h"
+#include "../include/xs.h"
int main (int argc, char *argv [])
{
fprintf (stderr, "test_reqrep_device running...\n");
- void *ctx = zmq_init (1);
+ void *ctx = xs_init (1);
assert (ctx);
// Create a req/rep device.
- void *xreq = zmq_socket (ctx, ZMQ_XREQ);
+ void *xreq = xs_socket (ctx, XS_XREQ);
assert (xreq);
- int rc = zmq_bind (xreq, "tcp://127.0.0.1:5560");
+ int rc = xs_bind (xreq, "tcp://127.0.0.1:5560");
assert (rc == 0);
- void *xrep = zmq_socket (ctx, ZMQ_XREP);
+ void *xrep = xs_socket (ctx, XS_XREP);
assert (xrep);
- rc = zmq_bind (xrep, "tcp://127.0.0.1:5561");
+ rc = xs_bind (xrep, "tcp://127.0.0.1:5561");
assert (rc == 0);
// Create a worker.
- void *rep = zmq_socket (ctx, ZMQ_REP);
+ void *rep = xs_socket (ctx, XS_REP);
assert (rep);
- rc = zmq_connect (rep, "tcp://127.0.0.1:5560");
+ rc = xs_connect (rep, "tcp://127.0.0.1:5560");
assert (rc == 0);
// Create a client.
- void *req = zmq_socket (ctx, ZMQ_REQ);
+ void *req = xs_socket (ctx, XS_REQ);
assert (req);
- rc = zmq_connect (req, "tcp://127.0.0.1:5561");
+ rc = xs_connect (req, "tcp://127.0.0.1:5561");
assert (rc == 0);
// Send a request.
- rc = zmq_send (req, "ABC", 3, ZMQ_SNDMORE);
+ rc = xs_send (req, "ABC", 3, XS_SNDMORE);
assert (rc == 3);
- rc = zmq_send (req, "DEF", 3, 0);
+ rc = xs_send (req, "DEF", 3, 0);
assert (rc == 3);
// Pass the request through the device.
for (int i = 0; i != 4; i++) {
- zmq_msg_t msg;
- rc = zmq_msg_init (&msg);
+ xs_msg_t msg;
+ rc = xs_msg_init (&msg);
assert (rc == 0);
- rc = zmq_recvmsg (xrep, &msg, 0);
+ rc = xs_recvmsg (xrep, &msg, 0);
assert (rc >= 0);
int rcvmore;
size_t sz = sizeof (rcvmore);
- rc = zmq_getsockopt (xrep, ZMQ_RCVMORE, &rcvmore, &sz);
+ rc = xs_getsockopt (xrep, XS_RCVMORE, &rcvmore, &sz);
assert (rc == 0);
- rc = zmq_sendmsg (xreq, &msg, rcvmore ? ZMQ_SNDMORE : 0);
+ rc = xs_sendmsg (xreq, &msg, rcvmore ? XS_SNDMORE : 0);
assert (rc >= 0);
}
// Receive the request.
char buff [3];
- rc = zmq_recv (rep, buff, 3, 0);
+ rc = xs_recv (rep, buff, 3, 0);
assert (rc == 3);
assert (memcmp (buff, "ABC", 3) == 0);
int rcvmore;
size_t sz = sizeof (rcvmore);
- rc = zmq_getsockopt (rep, ZMQ_RCVMORE, &rcvmore, &sz);
+ rc = xs_getsockopt (rep, XS_RCVMORE, &rcvmore, &sz);
assert (rc == 0);
assert (rcvmore);
- rc = zmq_recv (rep, buff, 3, 0);
+ rc = xs_recv (rep, buff, 3, 0);
assert (rc == 3);
assert (memcmp (buff, "DEF", 3) == 0);
- rc = zmq_getsockopt (rep, ZMQ_RCVMORE, &rcvmore, &sz);
+ rc = xs_getsockopt (rep, XS_RCVMORE, &rcvmore, &sz);
assert (rc == 0);
assert (!rcvmore);
// Send the reply.
- rc = zmq_send (rep, "GHI", 3, ZMQ_SNDMORE);
+ rc = xs_send (rep, "GHI", 3, XS_SNDMORE);
assert (rc == 3);
- rc = zmq_send (rep, "JKL", 3, 0);
+ rc = xs_send (rep, "JKL", 3, 0);
assert (rc == 3);
// Pass the reply through the device.
for (int i = 0; i != 4; i++) {
- zmq_msg_t msg;
- rc = zmq_msg_init (&msg);
+ xs_msg_t msg;
+ rc = xs_msg_init (&msg);
assert (rc == 0);
- rc = zmq_recvmsg (xreq, &msg, 0);
+ rc = xs_recvmsg (xreq, &msg, 0);
assert (rc >= 0);
int rcvmore;
- rc = zmq_getsockopt (xreq, ZMQ_RCVMORE, &rcvmore, &sz);
+ rc = xs_getsockopt (xreq, XS_RCVMORE, &rcvmore, &sz);
assert (rc == 0);
- rc = zmq_sendmsg (xrep, &msg, rcvmore ? ZMQ_SNDMORE : 0);
+ rc = xs_sendmsg (xrep, &msg, rcvmore ? XS_SNDMORE : 0);
assert (rc >= 0);
}
// Receive the reply.
- rc = zmq_recv (req, buff, 3, 0);
+ rc = xs_recv (req, buff, 3, 0);
assert (rc == 3);
assert (memcmp (buff, "GHI", 3) == 0);
- rc = zmq_getsockopt (req, ZMQ_RCVMORE, &rcvmore, &sz);
+ rc = xs_getsockopt (req, XS_RCVMORE, &rcvmore, &sz);
assert (rc == 0);
assert (rcvmore);
- rc = zmq_recv (req, buff, 3, 0);
+ rc = xs_recv (req, buff, 3, 0);
assert (rc == 3);
assert (memcmp (buff, "JKL", 3) == 0);
- rc = zmq_getsockopt (req, ZMQ_RCVMORE, &rcvmore, &sz);
+ rc = xs_getsockopt (req, XS_RCVMORE, &rcvmore, &sz);
assert (rc == 0);
assert (!rcvmore);
// Clean up.
- rc = zmq_close (req);
+ rc = xs_close (req);
assert (rc == 0);
- rc = zmq_close (rep);
+ rc = xs_close (rep);
assert (rc == 0);
- rc = zmq_close (xrep);
+ rc = xs_close (xrep);
assert (rc == 0);
- rc = zmq_close (xreq);
+ rc = xs_close (xreq);
assert (rc == 0);
- rc = zmq_term (ctx);
+ rc = xs_term (ctx);
assert (rc == 0);
return 0 ;
diff --git a/tests/test_reqrep_inproc.cpp b/tests/test_reqrep_inproc.cpp
index ae998eb..f715e4c 100644
--- a/tests/test_reqrep_inproc.cpp
+++ b/tests/test_reqrep_inproc.cpp
@@ -1,15 +1,15 @@
/*
- Copyright (c) 2010-2011 250bpm s.r.o.
+ Copyright (c) 2010-2012 250bpm s.r.o.
Copyright (c) 2010-2011 Other contributors as noted in the AUTHORS file
- This file is part of 0MQ.
+ This file is part of Crossroads project.
- 0MQ is free software; you can redistribute it and/or modify it under
+ Crossroads is free software; you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
- 0MQ is distributed in the hope that it will be useful,
+ Crossroads is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
@@ -26,28 +26,28 @@ int main (int argc, char *argv [])
{
fprintf (stderr, "test_reqrep_inproc running...\n");
- void *ctx = zmq_init (1);
+ void *ctx = xs_init (1);
assert (ctx);
- void *sb = zmq_socket (ctx, ZMQ_REP);
+ void *sb = xs_socket (ctx, XS_REP);
assert (sb);
- int rc = zmq_bind (sb, "inproc://a");
+ int rc = xs_bind (sb, "inproc://a");
assert (rc == 0);
- void *sc = zmq_socket (ctx, ZMQ_REQ);
+ void *sc = xs_socket (ctx, XS_REQ);
assert (sc);
- rc = zmq_connect (sc, "inproc://a");
+ rc = xs_connect (sc, "inproc://a");
assert (rc == 0);
bounce (sb, sc);
- rc = zmq_close (sc);
+ rc = xs_close (sc);
assert (rc == 0);
- rc = zmq_close (sb);
+ rc = xs_close (sb);
assert (rc == 0);
- rc = zmq_term (ctx);
+ rc = xs_term (ctx);
assert (rc == 0);
return 0 ;
diff --git a/tests/test_reqrep_ipc.cpp b/tests/test_reqrep_ipc.cpp
index fd9b28d..652c372 100644
--- a/tests/test_reqrep_ipc.cpp
+++ b/tests/test_reqrep_ipc.cpp
@@ -1,15 +1,15 @@
/*
- Copyright (c) 2010-2011 250bpm s.r.o.
+ Copyright (c) 2010-2012 250bpm s.r.o.
Copyright (c) 2010-2011 Other contributors as noted in the AUTHORS file
- This file is part of 0MQ.
+ This file is part of Crossroads project.
- 0MQ is free software; you can redistribute it and/or modify it under
+ Crossroads is free software; you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
- 0MQ is distributed in the hope that it will be useful,
+ Crossroads is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
@@ -26,28 +26,28 @@ int main (int argc, char *argv [])
{
fprintf (stderr, "test_reqrep_ipc running...\n");
- void *ctx = zmq_init (1);
+ void *ctx = xs_init (1);
assert (ctx);
- void *sb = zmq_socket (ctx, ZMQ_REP);
+ void *sb = xs_socket (ctx, XS_REP);
assert (sb);
- int rc = zmq_bind (sb, "ipc:///tmp/tester");
+ int rc = xs_bind (sb, "ipc:///tmp/tester");
assert (rc == 0);
- void *sc = zmq_socket (ctx, ZMQ_REQ);
+ void *sc = xs_socket (ctx, XS_REQ);
assert (sc);
- rc = zmq_connect (sc, "ipc:///tmp/tester");
+ rc = xs_connect (sc, "ipc:///tmp/tester");
assert (rc == 0);
bounce (sb, sc);
- rc = zmq_close (sc);
+ rc = xs_close (sc);
assert (rc == 0);
- rc = zmq_close (sb);
+ rc = xs_close (sb);
assert (rc == 0);
- rc = zmq_term (ctx);
+ rc = xs_term (ctx);
assert (rc == 0);
return 0 ;
diff --git a/tests/test_reqrep_tcp.cpp b/tests/test_reqrep_tcp.cpp
index 1e6bbbb..ea33709 100644
--- a/tests/test_reqrep_tcp.cpp
+++ b/tests/test_reqrep_tcp.cpp
@@ -1,16 +1,16 @@
/*
- Copyright (c) 2010-2011 250bpm s.r.o.
+ Copyright (c) 2010-2012 250bpm s.r.o.
Copyright (c) 2011 iMatix Corporation
Copyright (c) 2010-2011 Other contributors as noted in the AUTHORS file
- This file is part of 0MQ.
+ This file is part of Crossroads project.
- 0MQ is free software; you can redistribute it and/or modify it under
+ Crossroads is free software; you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
- 0MQ is distributed in the hope that it will be useful,
+ Crossroads is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
@@ -27,28 +27,28 @@ int main (int argc, char *argv [])
{
fprintf (stderr, "test_reqrep_tcp running...\n");
- void *ctx = zmq_init (1);
+ void *ctx = xs_init (1);
assert (ctx);
- void *sb = zmq_socket (ctx, ZMQ_REP);
+ void *sb = xs_socket (ctx, XS_REP);
assert (sb);
- int rc = zmq_bind (sb, "tcp://127.0.0.1:5560");
+ int rc = xs_bind (sb, "tcp://127.0.0.1:5560");
assert (rc == 0);
- void *sc = zmq_socket (ctx, ZMQ_REQ);
+ void *sc = xs_socket (ctx, XS_REQ);
assert (sc);
- rc = zmq_connect (sc, "tcp://127.0.0.1:5560");
+ rc = xs_connect (sc, "tcp://127.0.0.1:5560");
assert (rc == 0);
bounce (sb, sc);
- rc = zmq_close (sc);
+ rc = xs_close (sc);
assert (rc == 0);
- rc = zmq_close (sb);
+ rc = xs_close (sb);
assert (rc == 0);
- rc = zmq_term (ctx);
+ rc = xs_term (ctx);
assert (rc == 0);
return 0 ;
diff --git a/tests/test_shutdown_stress.cpp b/tests/test_shutdown_stress.cpp
index 811637c..021a00e 100644
--- a/tests/test_shutdown_stress.cpp
+++ b/tests/test_shutdown_stress.cpp
@@ -1,16 +1,16 @@
/*
- Copyright (c) 2010-2011 250bpm s.r.o.
+ Copyright (c) 2010-2012 250bpm s.r.o.
Copyright (c) 2011 iMatix Corporation
Copyright (c) 2010-2011 Other contributors as noted in the AUTHORS file
- This file is part of 0MQ.
+ This file is part of Crossroads project.
- 0MQ is free software; you can redistribute it and/or modify it under
+ Crossroads is free software; you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
- 0MQ is distributed in the hope that it will be useful,
+ Crossroads is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
@@ -19,7 +19,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "../include/zmq.h"
+#include "../include/xs.h"
#include <assert.h>
#include <pthread.h>
#include <stddef.h>
@@ -33,11 +33,11 @@ extern "C"
{
int rc;
- rc = zmq_connect (s, "tcp://127.0.0.1:5560");
+ rc = xs_connect (s, "tcp://127.0.0.1:5560");
assert (rc == 0);
// Start closing the socket while the connecting process is underway.
- rc = zmq_close (s);
+ rc = xs_close (s);
assert (rc == 0);
return NULL;
@@ -59,17 +59,17 @@ int main (int argc, char *argv [])
for (j = 0; j != 10; j++) {
// Check the shutdown with many parallel I/O threads.
- ctx = zmq_init (7);
+ ctx = xs_init (7);
assert (ctx);
- s1 = zmq_socket (ctx, ZMQ_PUB);
+ s1 = xs_socket (ctx, XS_PUB);
assert (s1);
- rc = zmq_bind (s1, "tcp://127.0.0.1:5560");
+ rc = xs_bind (s1, "tcp://127.0.0.1:5560");
assert (rc == 0);
for (i = 0; i != THREAD_COUNT; i++) {
- s2 = zmq_socket (ctx, ZMQ_SUB);
+ s2 = xs_socket (ctx, XS_SUB);
assert (s2);
rc = pthread_create (&threads [i], NULL, worker, s2);
assert (rc == 0);
@@ -80,10 +80,10 @@ int main (int argc, char *argv [])
assert (rc == 0);
}
- rc = zmq_close (s1);
+ rc = xs_close (s1);
assert (rc == 0);
- rc = zmq_term (ctx);
+ rc = xs_term (ctx);
assert (rc == 0);
}
diff --git a/tests/test_sub_forward.cpp b/tests/test_sub_forward.cpp
index 36a7f4a..56d34c7 100644
--- a/tests/test_sub_forward.cpp
+++ b/tests/test_sub_forward.cpp
@@ -1,16 +1,16 @@
/*
- Copyright (c) 2010-2011 250bpm s.r.o.
+ Copyright (c) 2010-2012 250bpm s.r.o.
Copyright (c) 2011 iMatix Corporation
Copyright (c) 2010-2011 Other contributors as noted in the AUTHORS file
- This file is part of 0MQ.
+ This file is part of Crossroads project.
- 0MQ is free software; you can redistribute it and/or modify it under
+ Crossroads is free software; you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
- 0MQ is distributed in the hope that it will be useful,
+ Crossroads is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
@@ -22,76 +22,76 @@
#include <assert.h>
#include <stdio.h>
-#include "../include/zmq.h"
-#include "../include/zmq_utils.h"
+#include "../include/xs.h"
+#include "../include/xs_utils.h"
int main (int argc, char *argv [])
{
fprintf (stderr, "test_sub_forward running...\n");
- void *ctx = zmq_init (1);
+ void *ctx = xs_init (1);
assert (ctx);
// First, create an intermediate device.
- void *xpub = zmq_socket (ctx, ZMQ_XPUB);
+ void *xpub = xs_socket (ctx, XS_XPUB);
assert (xpub);
- int rc = zmq_bind (xpub, "tcp://127.0.0.1:5560");
+ int rc = xs_bind (xpub, "tcp://127.0.0.1:5560");
assert (rc == 0);
- void *xsub = zmq_socket (ctx, ZMQ_XSUB);
+ void *xsub = xs_socket (ctx, XS_XSUB);
assert (xsub);
- rc = zmq_bind (xsub, "tcp://127.0.0.1:5561");
+ rc = xs_bind (xsub, "tcp://127.0.0.1:5561");
assert (rc == 0);
// Create a publisher.
- void *pub = zmq_socket (ctx, ZMQ_PUB);
+ void *pub = xs_socket (ctx, XS_PUB);
assert (pub);
- rc = zmq_connect (pub, "tcp://127.0.0.1:5561");
+ rc = xs_connect (pub, "tcp://127.0.0.1:5561");
assert (rc == 0);
// Create a subscriber.
- void *sub = zmq_socket (ctx, ZMQ_SUB);
+ void *sub = xs_socket (ctx, XS_SUB);
assert (sub);
- rc = zmq_connect (sub, "tcp://127.0.0.1:5560");
+ rc = xs_connect (sub, "tcp://127.0.0.1:5560");
assert (rc == 0);
// Subscribe for all messages.
- rc = zmq_setsockopt (sub, ZMQ_SUBSCRIBE, "", 0);
+ rc = xs_setsockopt (sub, XS_SUBSCRIBE, "", 0);
assert (rc == 0);
// Pass the subscription upstream through the device.
char buff [32];
- rc = zmq_recv (xpub, buff, sizeof (buff), 0);
+ rc = xs_recv (xpub, buff, sizeof (buff), 0);
assert (rc >= 0);
- rc = zmq_send (xsub, buff, rc, 0);
+ rc = xs_send (xsub, buff, rc, 0);
assert (rc >= 0);
// Wait a bit till the subscription gets to the publisher.
- zmq_sleep (1);
+ xs_sleep (1);
// Send an empty message.
- rc = zmq_send (pub, NULL, 0, 0);
+ rc = xs_send (pub, NULL, 0, 0);
assert (rc == 0);
// Pass the message downstream through the device.
- rc = zmq_recv (xsub, buff, sizeof (buff), 0);
+ rc = xs_recv (xsub, buff, sizeof (buff), 0);
assert (rc >= 0);
- rc = zmq_send (xpub, buff, rc, 0);
+ rc = xs_send (xpub, buff, rc, 0);
assert (rc >= 0);
// Receive the message in the subscriber.
- rc = zmq_recv (sub, buff, sizeof (buff), 0);
+ rc = xs_recv (sub, buff, sizeof (buff), 0);
assert (rc == 0);
// Clean up.
- rc = zmq_close (xpub);
+ rc = xs_close (xpub);
assert (rc == 0);
- rc = zmq_close (xsub);
+ rc = xs_close (xsub);
assert (rc == 0);
- rc = zmq_close (pub);
+ rc = xs_close (pub);
assert (rc == 0);
- rc = zmq_close (sub);
+ rc = xs_close (sub);
assert (rc == 0);
- rc = zmq_term (ctx);
+ rc = xs_term (ctx);
assert (rc == 0);
return 0 ;
diff --git a/tests/test_timeo.cpp b/tests/test_timeo.cpp
index e5ce0ac..79b4d39 100644
--- a/tests/test_timeo.cpp
+++ b/tests/test_timeo.cpp
@@ -1,15 +1,15 @@
/*
- Copyright (c) 2010-2011 250bpm s.r.o.
+ Copyright (c) 2010-2012 250bpm s.r.o.
Copyright (c) 2010-2011 Other contributors as noted in the AUTHORS file
- This file is part of 0MQ.
+ This file is part of Crossroads project.
- 0MQ is free software; you can redistribute it and/or modify it under
+ Crossroads is free software; you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
- 0MQ is distributed in the hope that it will be useful,
+ Crossroads is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
@@ -23,8 +23,8 @@
#include <pthread.h>
#include <stdio.h>
-#include "../include/zmq.h"
-#include "../include/zmq_utils.h"
+#include "../include/xs.h"
+#include "../include/xs_utils.h"
extern "C"
{
@@ -32,13 +32,13 @@ extern "C"
{
// Worker thread connects after delay of 1 second. Then it waits
// for 1 more second, so that async connect has time to succeed.
- zmq_sleep (1);
- void *sc = zmq_socket (ctx, ZMQ_PUSH);
+ xs_sleep (1);
+ void *sc = xs_socket (ctx, XS_PUSH);
assert (sc);
- int rc = zmq_connect (sc, "inproc://timeout_test");
+ int rc = xs_connect (sc, "inproc://timeout_test");
assert (rc == 0);
- zmq_sleep (1);
- rc = zmq_close (sc);
+ xs_sleep (1);
+ rc = xs_close (sc);
assert (rc == 0);
return NULL;
}
@@ -48,69 +48,69 @@ int main (int argc, char *argv [])
{
fprintf (stderr, "test_timeo running...\n");
- void *ctx = zmq_init (1);
+ void *ctx = xs_init (1);
assert (ctx);
// Create a disconnected socket.
- void *sb = zmq_socket (ctx, ZMQ_PULL);
+ void *sb = xs_socket (ctx, XS_PULL);
assert (sb);
- int rc = zmq_bind (sb, "inproc://timeout_test");
+ int rc = xs_bind (sb, "inproc://timeout_test");
assert (rc == 0);
// Check whether non-blocking recv returns immediately.
char buf [] = "12345678ABCDEFGH12345678abcdefgh";
- rc = zmq_recv (sb, buf, 32, ZMQ_DONTWAIT);
+ rc = xs_recv (sb, buf, 32, XS_DONTWAIT);
assert (rc == -1);
- assert (zmq_errno() == EAGAIN);
+ assert (xs_errno() == EAGAIN);
// Check whether recv timeout is honoured.
int timeout = 500;
size_t timeout_size = sizeof timeout;
- rc = zmq_setsockopt(sb, ZMQ_RCVTIMEO, &timeout, timeout_size);
+ rc = xs_setsockopt(sb, XS_RCVTIMEO, &timeout, timeout_size);
assert (rc == 0);
- void *watch = zmq_stopwatch_start ();
- rc = zmq_recv (sb, buf, 32, 0);
+ void *watch = xs_stopwatch_start ();
+ rc = xs_recv (sb, buf, 32, 0);
assert (rc == -1);
- assert (zmq_errno () == EAGAIN);
- unsigned long elapsed = zmq_stopwatch_stop (watch);
+ assert (xs_errno () == EAGAIN);
+ unsigned long elapsed = xs_stopwatch_stop (watch);
assert (elapsed > 440000 && elapsed < 550000);
// Check whether connection during the wait doesn't distort the timeout.
timeout = 2000;
- rc = zmq_setsockopt(sb, ZMQ_RCVTIMEO, &timeout, timeout_size);
+ rc = xs_setsockopt(sb, XS_RCVTIMEO, &timeout, timeout_size);
assert (rc == 0);
pthread_t thread;
rc = pthread_create (&thread, NULL, worker, ctx);
assert (rc == 0);
- watch = zmq_stopwatch_start ();
- rc = zmq_recv (sb, buf, 32, 0);
+ watch = xs_stopwatch_start ();
+ rc = xs_recv (sb, buf, 32, 0);
assert (rc == -1);
- assert (zmq_errno () == EAGAIN);
- elapsed = zmq_stopwatch_stop (watch);
+ assert (xs_errno () == EAGAIN);
+ elapsed = xs_stopwatch_stop (watch);
assert (elapsed > 1900000 && elapsed < 2100000);
rc = pthread_join (thread, NULL);
assert (rc == 0);
// Check that timeouts don't break normal message transfer.
- void *sc = zmq_socket (ctx, ZMQ_PUSH);
+ void *sc = xs_socket (ctx, XS_PUSH);
assert (sc);
- rc = zmq_setsockopt(sb, ZMQ_RCVTIMEO, &timeout, timeout_size);
+ rc = xs_setsockopt(sb, XS_RCVTIMEO, &timeout, timeout_size);
assert (rc == 0);
- rc = zmq_setsockopt(sb, ZMQ_SNDTIMEO, &timeout, timeout_size);
+ rc = xs_setsockopt(sb, XS_SNDTIMEO, &timeout, timeout_size);
assert (rc == 0);
- rc = zmq_connect (sc, "inproc://timeout_test");
+ rc = xs_connect (sc, "inproc://timeout_test");
assert (rc == 0);
- rc = zmq_send (sc, buf, 32, 0);
+ rc = xs_send (sc, buf, 32, 0);
assert (rc == 32);
- rc = zmq_recv (sb, buf, 32, 0);
+ rc = xs_recv (sb, buf, 32, 0);
assert (rc == 32);
// Clean-up.
- rc = zmq_close (sc);
+ rc = xs_close (sc);
assert (rc == 0);
- rc = zmq_close (sb);
+ rc = xs_close (sb);
assert (rc == 0);
- rc = zmq_term (ctx);
+ rc = xs_term (ctx);
assert (rc == 0);
return 0 ;
diff --git a/tests/testutil.hpp b/tests/testutil.hpp
index e68dc32..8dbdbdb 100644
--- a/tests/testutil.hpp
+++ b/tests/testutil.hpp
@@ -1,16 +1,16 @@
/*
- Copyright (c) 2009-2011 250bpm s.r.o.
+ Copyright (c) 2009-2012 250bpm s.r.o.
Copyright (c) 2007-2011 iMatix Corporation
Copyright (c) 2007-2011 Other contributors as noted in the AUTHORS file
- This file is part of 0MQ.
+ This file is part of Crossroads project.
- 0MQ is free software; you can redistribute it and/or modify it under
+ Crossroads is free software; you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
- 0MQ is distributed in the hope that it will be useful,
+ Crossroads is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
@@ -19,53 +19,53 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef __ZMQ_TEST_TESTUTIL_HPP_INCLUDED__
-#define __ZMQ_TEST_TESTUTIL_HPP_INCLUDED__
+#ifndef __XS_TEST_TESTUTIL_HPP_INCLUDED__
+#define __XS_TEST_TESTUTIL_HPP_INCLUDED__
#include <assert.h>
#include <string.h>
-#include "../include/zmq.h"
+#include "../include/xs.h"
inline void bounce (void *sb, void *sc)
{
const char *content = "12345678ABCDEFGH12345678abcdefgh";
// Send the message.
- int rc = zmq_send (sc, content, 32, ZMQ_SNDMORE);
+ int rc = xs_send (sc, content, 32, XS_SNDMORE);
assert (rc == 32);
- rc = zmq_send (sc, content, 32, 0);
+ rc = xs_send (sc, content, 32, 0);
assert (rc == 32);
// Bounce the message back.
char buf1 [32];
- rc = zmq_recv (sb, buf1, 32, 0);
+ rc = xs_recv (sb, buf1, 32, 0);
assert (rc == 32);
int rcvmore;
size_t sz = sizeof (rcvmore);
- rc = zmq_getsockopt (sb, ZMQ_RCVMORE, &rcvmore, &sz);
+ rc = xs_getsockopt (sb, XS_RCVMORE, &rcvmore, &sz);
assert (rc == 0);
assert (rcvmore);
- rc = zmq_recv (sb, buf1, 32, 0);
+ rc = xs_recv (sb, buf1, 32, 0);
assert (rc == 32);
- rc = zmq_getsockopt (sb, ZMQ_RCVMORE, &rcvmore, &sz);
+ rc = xs_getsockopt (sb, XS_RCVMORE, &rcvmore, &sz);
assert (rc == 0);
assert (!rcvmore);
- rc = zmq_send (sb, buf1, 32, ZMQ_SNDMORE);
+ rc = xs_send (sb, buf1, 32, XS_SNDMORE);
assert (rc == 32);
- rc = zmq_send (sb, buf1, 32, 0);
+ rc = xs_send (sb, buf1, 32, 0);
assert (rc == 32);
// Receive the bounced message.
char buf2 [32];
- rc = zmq_recv (sc, buf2, 32, 0);
+ rc = xs_recv (sc, buf2, 32, 0);
assert (rc == 32);
- rc = zmq_getsockopt (sc, ZMQ_RCVMORE, &rcvmore, &sz);
+ rc = xs_getsockopt (sc, XS_RCVMORE, &rcvmore, &sz);
assert (rc == 0);
assert (rcvmore);
- rc = zmq_recv (sc, buf2, 32, 0);
+ rc = xs_recv (sc, buf2, 32, 0);
assert (rc == 32);
- rc = zmq_getsockopt (sc, ZMQ_RCVMORE, &rcvmore, &sz);
+ rc = xs_getsockopt (sc, XS_RCVMORE, &rcvmore, &sz);
assert (rc == 0);
assert (!rcvmore);