Commit 0b3478d6 authored by Ian Barber's avatar Ian Barber

Fix whitespace in test

parent b5ace39e
...@@ -39,7 +39,7 @@ int main (int argc, char *argv []) ...@@ -39,7 +39,7 @@ int main (int argc, char *argv [])
assert (context); assert (context);
void *to = zmq_socket(context, ZMQ_PULL); void *to = zmq_socket(context, ZMQ_PULL);
assert (to); assert (to);
val = 0; val = 0;
rc = zmq_setsockopt(to, ZMQ_LINGER, &val, sizeof(val)); rc = zmq_setsockopt(to, ZMQ_LINGER, &val, sizeof(val));
assert (rc == 0); assert (rc == 0);
...@@ -49,7 +49,7 @@ int main (int argc, char *argv []) ...@@ -49,7 +49,7 @@ int main (int argc, char *argv [])
// Create a socket pushing to two endpoints - only 1 message should arrive. // Create a socket pushing to two endpoints - only 1 message should arrive.
void *from = zmq_socket (context, ZMQ_PUSH); void *from = zmq_socket (context, ZMQ_PUSH);
assert(from); assert(from);
val = 0; val = 0;
zmq_setsockopt (from, ZMQ_LINGER, &val, sizeof(val)); zmq_setsockopt (from, ZMQ_LINGER, &val, sizeof(val));
rc = zmq_connect (from, "tcp://localhost:5556"); rc = zmq_connect (from, "tcp://localhost:5556");
...@@ -64,7 +64,7 @@ int main (int argc, char *argv []) ...@@ -64,7 +64,7 @@ int main (int argc, char *argv [])
rc = zmq_send (from, message.data(), message.size(), 0); rc = zmq_send (from, message.data(), message.size(), 0);
assert(rc >= 0); assert(rc >= 0);
} }
sleep(1); sleep(1);
seen = 0; seen = 0;
for (int i = 0; i < 10; ++i) for (int i = 0; i < 10; ++i)
...@@ -76,43 +76,43 @@ int main (int argc, char *argv []) ...@@ -76,43 +76,43 @@ int main (int argc, char *argv [])
seen++; seen++;
} }
assert (seen == 5); assert (seen == 5);
rc = zmq_close (from); rc = zmq_close (from);
assert (rc == 0); assert (rc == 0);
rc = zmq_close (to); rc = zmq_close (to);
assert (rc == 0); assert (rc == 0);
rc = zmq_ctx_destroy(context); rc = zmq_ctx_destroy(context);
assert (rc == 0); assert (rc == 0);
context = zmq_ctx_new(); context = zmq_ctx_new();
std::cout << " Rerunning with DELAY_ATTACH_ON_CONNECT\n"; fprintf (stderr, " Rerunning with DELAY_ATTACH_ON_CONNECT\n");
to = zmq_socket (context, ZMQ_PULL); to = zmq_socket (context, ZMQ_PULL);
assert (to); assert (to);
rc = zmq_bind (to, "tcp://*:5560"); rc = zmq_bind (to, "tcp://*:5560");
assert(rc == 0); assert (rc == 0);
val = 0; val = 0;
rc = zmq_setsockopt (to, ZMQ_LINGER, &val, sizeof(val)); rc = zmq_setsockopt (to, ZMQ_LINGER, &val, sizeof(val));
assert (rc == 0); assert (rc == 0);
// Create a socket pushing to two endpoints - all messages should arrive. // Create a socket pushing to two endpoints - all messages should arrive.
from = zmq_socket (context, ZMQ_PUSH); from = zmq_socket (context, ZMQ_PUSH);
assert (from); assert (from);
val = 0; val = 0;
rc = zmq_setsockopt (from, ZMQ_LINGER, &val, sizeof(val)); rc = zmq_setsockopt (from, ZMQ_LINGER, &val, sizeof(val));
assert (rc == 0); assert (rc == 0);
val = 1; val = 1;
rc = zmq_setsockopt (from, ZMQ_DELAY_ATTACH_ON_CONNECT, &val, sizeof(val)); rc = zmq_setsockopt (from, ZMQ_DELAY_ATTACH_ON_CONNECT, &val, sizeof(val));
assert (rc == 0); assert (rc == 0);
rc = zmq_connect (from, "tcp://localhost:5561"); rc = zmq_connect (from, "tcp://localhost:5561");
assert (rc == 0); assert (rc == 0);
rc = zmq_connect (from, "tcp://localhost:5560"); rc = zmq_connect (from, "tcp://localhost:5560");
assert (rc == 0); assert (rc == 0);
...@@ -123,9 +123,9 @@ int main (int argc, char *argv []) ...@@ -123,9 +123,9 @@ int main (int argc, char *argv [])
rc = zmq_send (from, message.data(), message.size(), 0); rc = zmq_send (from, message.data(), message.size(), 0);
assert (rc >= 0); assert (rc >= 0);
} }
sleep(1); sleep(1);
seen = 0; seen = 0;
for (int i = 0; i < 10; ++i) for (int i = 0; i < 10; ++i)
{ {
...@@ -136,7 +136,7 @@ int main (int argc, char *argv []) ...@@ -136,7 +136,7 @@ int main (int argc, char *argv [])
rc = zmq_close (from); rc = zmq_close (from);
assert (rc == 0); assert (rc == 0);
rc = zmq_close (to); rc = zmq_close (to);
assert (rc == 0); assert (rc == 0);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment