~ubuntu-branches/ubuntu/wily/zeromq3/wily-proposed

« back to all changes in this revision

Viewing changes to tests/test_invalid_rep.cpp

  • Committer: Package Import Robot
  • Author(s): Alessandro Ghedini
  • Date: 2014-03-16 14:02:28 UTC
  • mfrom: (1.1.6) (6.1.1 experimental)
  • Revision ID: package-import@ubuntu.com-20140316140228-ig1sgh7czk59m9ux
Tags: 4.0.4+dfsg-1
* QA upload; orphan the package
  - Upload to unstable
* New upstream release
* Update repack.stub script
* Drop 02_fix-exported-symbols.patch and 03_fix-s390-rdtsc.patch
  (merged upstream)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
 
    Copyright (c) 2010-2011 250bpm s.r.o.
3
 
    Copyright (c) 2011 VMware, Inc.
4
 
    Copyright (c) 2010-2011 Other contributors as noted in the AUTHORS file
 
2
    Copyright (c) 2007-2013 Contributors as noted in the AUTHORS file
5
3
 
6
4
    This file is part of 0MQ.
7
5
 
19
17
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
20
18
*/
21
19
 
22
 
#include "../include/zmq.h"
23
 
#include <stdio.h>
24
 
 
25
 
#undef NDEBUG
26
 
#include <assert.h>
 
20
#include "testutil.hpp"
27
21
 
28
22
int main (void)
29
23
{
30
 
    fprintf (stderr, "test_invalid_rep running...\n");
31
 
 
 
24
    setup_test_environment();
32
25
    //  Create REQ/ROUTER wiring.
33
 
    void *ctx = zmq_init (1);
 
26
    void *ctx = zmq_ctx_new ();
34
27
    assert (ctx);
 
28
    
35
29
    void *router_socket = zmq_socket (ctx, ZMQ_ROUTER);
36
30
    assert (router_socket);
 
31
    
37
32
    void *req_socket = zmq_socket (ctx, ZMQ_REQ);
38
33
    assert (req_socket);
 
34
    
39
35
    int linger = 0;
40
36
    int rc = zmq_setsockopt (router_socket, ZMQ_LINGER, &linger, sizeof (int));
41
37
    assert (rc == 0);
77
73
    //  Check whether we've got the valid reply.
78
74
    rc = zmq_recv (req_socket, body, sizeof (body), 0);
79
75
    assert (rc == 1);
80
 
        assert (body [0] == 'b');
 
76
    assert (body [0] == 'b');
81
77
 
82
78
    //  Tear down the wiring.
83
79
    rc = zmq_close (router_socket);
84
80
    assert (rc == 0);
85
81
    rc = zmq_close (req_socket);
86
82
    assert (rc == 0);
87
 
    rc = zmq_term (ctx);
 
83
    rc = zmq_ctx_term (ctx);
88
84
    assert (rc == 0);
89
85
 
90
86
    return 0;