Permalink
Browse files

Finished test case

  • Loading branch information...
1 parent 2ddd982 commit cddfcadd5951049cea6e26847e021667d3a3f199 @hintjens hintjens committed Mar 20, 2012
Showing with 24 additions and 17 deletions.
  1. +24 −17 337/issue.c
View
@@ -1,24 +1,31 @@
#include "zmq.h"
+#include "assert.h"
int main (void) {
- void *context = zmq_init (1);
- void *client = zmq_socket (context, ZMQ_DEALER);
- zmq_bind (client, "tcp://*:5555");
-
- void *server = zmq_socket (context, ZMQ_DEALER);
- zmq_connect (server, "tcp://localhost:5555");
-
- zmq_msg_t msg;
- zmq_msg_init (&msg);
- zmq_msg_send (&msg, client, 0);
- zmq_msg_close (&msg);
+ void *context = zmq_ctx_new ();
+ zmq_ctx_set (context, ZMQ_MAX_SOCKETS, 5);
+ int max_sockets = zmq_ctx_get (context, ZMQ_MAX_SOCKETS);
+ assert (max_sockets == 5);
- zmq_msg_init (&msg);
- zmq_msg_recv (&msg, server, 0);
- zmq_msg_close (&msg);
+ void *s1 = zmq_socket (context, ZMQ_DEALER);
+ assert (s1);
+ void *s2 = zmq_socket (context, ZMQ_DEALER);
+ assert (s2);
+ void *s3 = zmq_socket (context, ZMQ_DEALER);
+ assert (s3);
+ void *s4 = zmq_socket (context, ZMQ_DEALER);
+ assert (s4);
+ void *s5 = zmq_socket (context, ZMQ_DEALER);
+ assert (s5);
+ void *s6 = zmq_socket (context, ZMQ_DEALER);
+ assert (s6 == NULL);
+
+ zmq_close (s1);
+ zmq_close (s2);
+ zmq_close (s3);
+ zmq_close (s4);
+ zmq_close (s5);
- zmq_close (client);
- zmq_close (server);
- zmq_term (context);
+ zmq_ctx_destroy (context);
return 0;
}

0 comments on commit cddfcad

Please sign in to comment.