Example #1
0
int main (void)
{
    setup_test_environment();
    void *ctx = zmq_ctx_new ();
    assert (ctx);

    const char *binds [] = { "inproc://a", "tcp://127.0.0.1:5555" };
    const char *connects [] = { "inproc://a", "tcp://localhost:5555" };

    for (int transport = 0; transport < 2; transport++) {
        bind_address = binds [transport];
        connect_address = connects [transport];

        // SHALL route outgoing messages to connected peers using a round-robin
        // strategy.
        test_round_robin_out (ctx);

        // The request and reply messages SHALL have this format on the wire:
        // * A delimiter, consisting of an empty frame, added by the REQ socket.
        // * One or more data frames, comprising the message visible to the
        //   application.
        test_req_message_format (ctx);

        // SHALL block on sending, or return a suitable error, when it has no 
        // connected peers.
        test_block_on_send_no_peers (ctx);

        // SHALL accept an incoming message only from the last peer that it sent a
        // request to.
        // SHALL discard silently any messages received from other peers.
        // PH: this test is still failing; disabled for now to allow build to
        // complete.
        // test_req_only_listens_to_current_peer (ctx);
    }

    int rc = zmq_ctx_term (ctx);
    assert (rc == 0);

    return 0 ;
}
Example #2
0
int main (void)
{
    setup_test_environment();
    void *ctx = zmq_ctx_new ();
    assert (ctx);

    const char *binds [] = { "inproc://a", "tcp://127.0.0.1:5555" };
    const char *connects [] = { "inproc://a", "tcp://localhost:5555" };

    for (int transports = 0; transports < 2; ++transports) {
        bind_address = binds [transports];
        connect_address = connects [transports];

        // SHALL route outgoing messages to available peers using a round-robin
        // strategy.
        test_round_robin_out (ctx);

        // SHALL receive incoming messages from its peers using a fair-queuing
        // strategy.
        test_fair_queue_in (ctx);

        // SHALL block on sending, or return a suitable error, when it has no connected peers.
        test_block_on_send_no_peers (ctx);

        // SHALL create a double queue when a peer connects to it. If this peer
        // disconnects, the DEALER socket SHALL destroy its double queue and SHALL
        // discard any messages it contains.
        // *** Test disabled until libzmq does this properly ***
        // test_destroy_queue_on_disconnect (ctx);
    }

    int rc = zmq_ctx_term (ctx);
    assert (rc == 0);

    return 0 ;
}