2023-06-05 00:16:05 +01:00
|
|
|
/* SPDX-License-Identifier: MPL-2.0 */
|
2018-02-25 20:20:44 +00:00
|
|
|
|
|
|
|
#include "testutil.hpp"
|
2018-08-22 10:54:24 +02:00
|
|
|
#include "testutil_unity.hpp"
|
2018-02-25 20:20:44 +00:00
|
|
|
|
2019-03-24 12:51:28 -04:00
|
|
|
SETUP_TEARDOWN_TESTCONTEXT
|
2018-02-25 20:20:44 +00:00
|
|
|
|
2018-08-22 10:54:24 +02:00
|
|
|
const uint8_t unsubscribe_a_msg[] = {0, 'A'};
|
|
|
|
const uint8_t subscribe_a_msg[] = {1, 'A'};
|
|
|
|
const uint8_t subscribe_b_msg[] = {1, 'B'};
|
|
|
|
|
|
|
|
const char test_endpoint[] = "inproc://soname";
|
|
|
|
const char topic_a[] = "A";
|
|
|
|
const char topic_b[] = "B";
|
|
|
|
|
2018-02-25 20:20:44 +00:00
|
|
|
void test_xpub_verbose_one_sub ()
|
|
|
|
{
|
2018-08-22 10:54:24 +02:00
|
|
|
void *pub = test_context_socket (ZMQ_XPUB);
|
|
|
|
TEST_ASSERT_SUCCESS_ERRNO (zmq_bind (pub, test_endpoint));
|
2018-02-25 20:20:44 +00:00
|
|
|
|
2018-08-22 10:54:24 +02:00
|
|
|
void *sub = test_context_socket (ZMQ_SUB);
|
|
|
|
TEST_ASSERT_SUCCESS_ERRNO (zmq_connect (sub, test_endpoint));
|
2018-02-25 20:20:44 +00:00
|
|
|
|
|
|
|
// Subscribe for A
|
2018-08-22 10:54:24 +02:00
|
|
|
TEST_ASSERT_SUCCESS_ERRNO (zmq_setsockopt (sub, ZMQ_SUBSCRIBE, topic_a, 1));
|
2018-02-25 20:20:44 +00:00
|
|
|
|
|
|
|
// Receive subscriptions from subscriber
|
2018-08-22 10:54:24 +02:00
|
|
|
recv_array_expect_success (pub, subscribe_a_msg, 0);
|
2018-02-25 20:20:44 +00:00
|
|
|
|
|
|
|
// Subscribe socket for B instead
|
2018-08-22 10:54:24 +02:00
|
|
|
TEST_ASSERT_SUCCESS_ERRNO (zmq_setsockopt (sub, ZMQ_SUBSCRIBE, topic_b, 1));
|
2018-02-25 20:20:44 +00:00
|
|
|
|
|
|
|
// Receive subscriptions from subscriber
|
2018-08-22 10:54:24 +02:00
|
|
|
recv_array_expect_success (pub, subscribe_b_msg, 0);
|
2018-02-25 20:20:44 +00:00
|
|
|
|
|
|
|
// Subscribe again for A again
|
2018-08-22 10:54:24 +02:00
|
|
|
TEST_ASSERT_SUCCESS_ERRNO (zmq_setsockopt (sub, ZMQ_SUBSCRIBE, topic_a, 1));
|
2018-02-25 20:20:44 +00:00
|
|
|
|
|
|
|
// This time it is duplicated, so it will be filtered out
|
2018-08-22 10:54:24 +02:00
|
|
|
TEST_ASSERT_FAILURE_ERRNO (EAGAIN, zmq_recv (pub, NULL, 0, ZMQ_DONTWAIT));
|
2018-02-25 20:20:44 +00:00
|
|
|
|
|
|
|
int verbose = 1;
|
2018-08-22 10:54:24 +02:00
|
|
|
TEST_ASSERT_SUCCESS_ERRNO (
|
|
|
|
zmq_setsockopt (pub, ZMQ_XPUB_VERBOSE, &verbose, sizeof (int)));
|
2018-02-25 20:20:44 +00:00
|
|
|
|
|
|
|
// Subscribe socket for A again
|
2018-08-22 10:54:24 +02:00
|
|
|
TEST_ASSERT_SUCCESS_ERRNO (zmq_setsockopt (sub, ZMQ_SUBSCRIBE, topic_a, 1));
|
2018-02-25 20:20:44 +00:00
|
|
|
|
|
|
|
// This time with VERBOSE the duplicated sub will be received
|
2018-08-22 10:54:24 +02:00
|
|
|
recv_array_expect_success (pub, subscribe_a_msg, 0);
|
2018-02-25 20:20:44 +00:00
|
|
|
|
|
|
|
// Sending A message and B Message
|
2018-08-22 10:54:24 +02:00
|
|
|
send_string_expect_success (pub, topic_a, 0);
|
|
|
|
send_string_expect_success (pub, topic_b, 0);
|
2018-02-25 20:20:44 +00:00
|
|
|
|
2018-08-22 10:54:24 +02:00
|
|
|
recv_string_expect_success (sub, topic_a, 0);
|
|
|
|
recv_string_expect_success (sub, topic_b, 0);
|
2018-02-25 20:20:44 +00:00
|
|
|
|
|
|
|
// Clean up.
|
2018-08-22 10:54:24 +02:00
|
|
|
test_context_socket_close (pub);
|
|
|
|
test_context_socket_close (sub);
|
2018-02-25 20:20:44 +00:00
|
|
|
}
|
|
|
|
|
2018-08-22 10:54:24 +02:00
|
|
|
void create_xpub_with_2_subs (void **pub_, void **sub0_, void **sub1_)
|
2018-02-25 20:20:44 +00:00
|
|
|
{
|
2018-08-22 10:54:24 +02:00
|
|
|
*pub_ = test_context_socket (ZMQ_XPUB);
|
|
|
|
TEST_ASSERT_SUCCESS_ERRNO (zmq_bind (*pub_, test_endpoint));
|
|
|
|
|
|
|
|
*sub0_ = test_context_socket (ZMQ_SUB);
|
|
|
|
TEST_ASSERT_SUCCESS_ERRNO (zmq_connect (*sub0_, test_endpoint));
|
|
|
|
|
|
|
|
*sub1_ = test_context_socket (ZMQ_SUB);
|
|
|
|
TEST_ASSERT_SUCCESS_ERRNO (zmq_connect (*sub1_, test_endpoint));
|
2018-08-20 16:14:46 +02:00
|
|
|
}
|
2018-02-25 20:20:44 +00:00
|
|
|
|
2018-08-20 16:14:46 +02:00
|
|
|
void create_duplicate_subscription (void *pub_, void *sub0_, void *sub1_)
|
|
|
|
{
|
|
|
|
// Subscribe for A
|
2018-08-22 10:54:24 +02:00
|
|
|
TEST_ASSERT_SUCCESS_ERRNO (
|
|
|
|
zmq_setsockopt (sub0_, ZMQ_SUBSCRIBE, topic_a, 1));
|
2018-02-25 20:20:44 +00:00
|
|
|
|
|
|
|
// Receive subscriptions from subscriber
|
2018-08-22 10:54:24 +02:00
|
|
|
recv_array_expect_success (pub_, subscribe_a_msg, 0);
|
2018-02-25 20:20:44 +00:00
|
|
|
|
2018-08-20 16:14:46 +02:00
|
|
|
// Subscribe again for A on the other socket
|
2018-08-22 10:54:24 +02:00
|
|
|
TEST_ASSERT_SUCCESS_ERRNO (
|
|
|
|
zmq_setsockopt (sub1_, ZMQ_SUBSCRIBE, topic_a, 1));
|
2018-02-25 20:20:44 +00:00
|
|
|
|
2018-08-20 16:14:46 +02:00
|
|
|
// This time it is duplicated, so it will be filtered out by XPUB
|
2018-08-22 10:54:24 +02:00
|
|
|
TEST_ASSERT_FAILURE_ERRNO (EAGAIN, zmq_recv (pub_, NULL, 0, ZMQ_DONTWAIT));
|
2018-08-20 16:14:46 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void test_xpub_verbose_two_subs ()
|
|
|
|
{
|
|
|
|
void *pub, *sub0, *sub1;
|
2018-08-22 10:54:24 +02:00
|
|
|
create_xpub_with_2_subs (&pub, &sub0, &sub1);
|
2018-08-20 16:14:46 +02:00
|
|
|
create_duplicate_subscription (pub, sub0, sub1);
|
2018-02-25 20:20:44 +00:00
|
|
|
|
|
|
|
// Subscribe socket for B instead
|
2018-08-22 10:54:24 +02:00
|
|
|
TEST_ASSERT_SUCCESS_ERRNO (
|
|
|
|
zmq_setsockopt (sub0, ZMQ_SUBSCRIBE, topic_b, 1));
|
2018-02-25 20:20:44 +00:00
|
|
|
|
|
|
|
// Receive subscriptions from subscriber
|
2018-08-22 10:54:24 +02:00
|
|
|
recv_array_expect_success (pub, subscribe_b_msg, 0);
|
2018-02-25 20:20:44 +00:00
|
|
|
|
|
|
|
int verbose = 1;
|
2018-08-22 10:54:24 +02:00
|
|
|
TEST_ASSERT_SUCCESS_ERRNO (
|
|
|
|
zmq_setsockopt (pub, ZMQ_XPUB_VERBOSE, &verbose, sizeof (int)));
|
2018-02-25 20:20:44 +00:00
|
|
|
|
|
|
|
// Subscribe socket for A again
|
2018-08-22 10:54:24 +02:00
|
|
|
TEST_ASSERT_SUCCESS_ERRNO (
|
|
|
|
zmq_setsockopt (sub1, ZMQ_SUBSCRIBE, topic_a, 1));
|
2018-02-25 20:20:44 +00:00
|
|
|
|
|
|
|
// This time with VERBOSE the duplicated sub will be received
|
2018-08-22 10:54:24 +02:00
|
|
|
recv_array_expect_success (pub, subscribe_a_msg, 0);
|
2018-02-25 20:20:44 +00:00
|
|
|
|
|
|
|
// Sending A message and B Message
|
2018-08-22 10:54:24 +02:00
|
|
|
send_string_expect_success (pub, topic_a, 0);
|
2018-02-25 20:20:44 +00:00
|
|
|
|
2018-08-22 10:54:24 +02:00
|
|
|
send_string_expect_success (pub, topic_b, 0);
|
2018-02-25 20:20:44 +00:00
|
|
|
|
2018-08-22 10:54:24 +02:00
|
|
|
recv_string_expect_success (sub0, topic_a, 0);
|
|
|
|
recv_string_expect_success (sub1, topic_a, 0);
|
|
|
|
recv_string_expect_success (sub0, topic_b, 0);
|
2018-02-25 20:20:44 +00:00
|
|
|
|
|
|
|
// Clean up.
|
2018-08-22 10:54:24 +02:00
|
|
|
test_context_socket_close (pub);
|
|
|
|
test_context_socket_close (sub0);
|
|
|
|
test_context_socket_close (sub1);
|
2018-02-25 20:20:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void test_xpub_verboser_one_sub ()
|
|
|
|
{
|
|
|
|
// Create a publisher
|
2018-08-22 10:54:24 +02:00
|
|
|
void *pub = test_context_socket (ZMQ_XPUB);
|
|
|
|
TEST_ASSERT_SUCCESS_ERRNO (zmq_bind (pub, test_endpoint));
|
2018-02-25 20:20:44 +00:00
|
|
|
|
|
|
|
// Create a subscriber
|
2018-08-22 10:54:24 +02:00
|
|
|
void *sub = test_context_socket (ZMQ_SUB);
|
|
|
|
TEST_ASSERT_SUCCESS_ERRNO (zmq_connect (sub, test_endpoint));
|
2018-02-25 20:20:44 +00:00
|
|
|
|
|
|
|
// Unsubscribe for A, does not exist yet
|
2018-08-22 10:54:24 +02:00
|
|
|
TEST_ASSERT_SUCCESS_ERRNO (
|
|
|
|
zmq_setsockopt (sub, ZMQ_UNSUBSCRIBE, topic_a, 1));
|
2018-02-25 20:20:44 +00:00
|
|
|
|
|
|
|
// Does not exist, so it will be filtered out by XSUB
|
2018-08-22 10:54:24 +02:00
|
|
|
TEST_ASSERT_FAILURE_ERRNO (EAGAIN, zmq_recv (pub, NULL, 0, ZMQ_DONTWAIT));
|
2018-02-25 20:20:44 +00:00
|
|
|
|
|
|
|
// Subscribe for A
|
2018-08-22 10:54:24 +02:00
|
|
|
TEST_ASSERT_SUCCESS_ERRNO (zmq_setsockopt (sub, ZMQ_SUBSCRIBE, topic_a, 1));
|
2018-02-25 20:20:44 +00:00
|
|
|
|
|
|
|
// Receive subscriptions from subscriber
|
2018-08-22 10:54:24 +02:00
|
|
|
recv_array_expect_success (pub, subscribe_a_msg, 0);
|
2018-02-25 20:20:44 +00:00
|
|
|
|
|
|
|
// Subscribe again for A again, XSUB will increase refcount
|
2018-08-22 10:54:24 +02:00
|
|
|
TEST_ASSERT_SUCCESS_ERRNO (zmq_setsockopt (sub, ZMQ_SUBSCRIBE, topic_a, 1));
|
2018-02-25 20:20:44 +00:00
|
|
|
|
|
|
|
// This time it is duplicated, so it will be filtered out by XPUB
|
2018-08-22 10:54:24 +02:00
|
|
|
TEST_ASSERT_FAILURE_ERRNO (EAGAIN, zmq_recv (pub, NULL, 0, ZMQ_DONTWAIT));
|
2018-02-25 20:20:44 +00:00
|
|
|
|
|
|
|
// Unsubscribe for A, this time it exists in XPUB
|
2018-08-22 10:54:24 +02:00
|
|
|
TEST_ASSERT_SUCCESS_ERRNO (
|
|
|
|
zmq_setsockopt (sub, ZMQ_UNSUBSCRIBE, topic_a, 1));
|
2018-02-25 20:20:44 +00:00
|
|
|
|
|
|
|
// XSUB refcounts and will not actually send unsub to PUB until the number
|
|
|
|
// of unsubs match the earlier subs
|
2018-08-22 10:54:24 +02:00
|
|
|
TEST_ASSERT_SUCCESS_ERRNO (
|
|
|
|
zmq_setsockopt (sub, ZMQ_UNSUBSCRIBE, topic_a, 1));
|
2018-02-25 20:20:44 +00:00
|
|
|
|
|
|
|
// Receive unsubscriptions from subscriber
|
2018-08-22 10:54:24 +02:00
|
|
|
recv_array_expect_success (pub, unsubscribe_a_msg, 0);
|
2018-02-25 20:20:44 +00:00
|
|
|
|
|
|
|
// XSUB only sends the last and final unsub, so XPUB will only receive 1
|
2018-08-22 10:54:24 +02:00
|
|
|
TEST_ASSERT_FAILURE_ERRNO (EAGAIN, zmq_recv (pub, NULL, 0, ZMQ_DONTWAIT));
|
2018-02-25 20:20:44 +00:00
|
|
|
|
|
|
|
// Unsubscribe for A, does not exist anymore
|
2018-08-22 10:54:24 +02:00
|
|
|
TEST_ASSERT_SUCCESS_ERRNO (
|
|
|
|
zmq_setsockopt (sub, ZMQ_UNSUBSCRIBE, topic_a, 1));
|
2018-02-25 20:20:44 +00:00
|
|
|
|
|
|
|
// Does not exist, so it will be filtered out by XSUB
|
2018-08-22 10:54:24 +02:00
|
|
|
TEST_ASSERT_FAILURE_ERRNO (EAGAIN, zmq_recv (pub, NULL, 0, ZMQ_DONTWAIT));
|
2018-02-25 20:20:44 +00:00
|
|
|
|
|
|
|
int verbose = 1;
|
2018-08-22 10:54:24 +02:00
|
|
|
TEST_ASSERT_SUCCESS_ERRNO (
|
|
|
|
zmq_setsockopt (pub, ZMQ_XPUB_VERBOSER, &verbose, sizeof (int)));
|
2018-02-25 20:20:44 +00:00
|
|
|
|
|
|
|
// Subscribe socket for A again
|
2018-08-22 10:54:24 +02:00
|
|
|
TEST_ASSERT_SUCCESS_ERRNO (zmq_setsockopt (sub, ZMQ_SUBSCRIBE, topic_a, 1));
|
2018-02-25 20:20:44 +00:00
|
|
|
|
|
|
|
// Receive subscriptions from subscriber, did not exist anymore
|
2018-08-22 10:54:24 +02:00
|
|
|
recv_array_expect_success (pub, subscribe_a_msg, 0);
|
2018-02-25 20:20:44 +00:00
|
|
|
|
|
|
|
// Sending A message to make sure everything still works
|
2018-08-22 10:54:24 +02:00
|
|
|
send_string_expect_success (pub, topic_a, 0);
|
2018-02-25 20:20:44 +00:00
|
|
|
|
2018-08-22 10:54:24 +02:00
|
|
|
recv_string_expect_success (sub, topic_a, 0);
|
2018-02-25 20:20:44 +00:00
|
|
|
|
|
|
|
// Unsubscribe for A, this time it exists
|
2018-08-22 10:54:24 +02:00
|
|
|
TEST_ASSERT_SUCCESS_ERRNO (
|
|
|
|
zmq_setsockopt (sub, ZMQ_UNSUBSCRIBE, topic_a, 1));
|
2018-02-25 20:20:44 +00:00
|
|
|
|
|
|
|
// Receive unsubscriptions from subscriber
|
2018-08-22 10:54:24 +02:00
|
|
|
recv_array_expect_success (pub, unsubscribe_a_msg, 0);
|
2018-02-25 20:20:44 +00:00
|
|
|
|
|
|
|
// Unsubscribe for A again, it does not exist anymore so XSUB will filter
|
2018-08-22 10:54:24 +02:00
|
|
|
TEST_ASSERT_SUCCESS_ERRNO (
|
|
|
|
zmq_setsockopt (sub, ZMQ_UNSUBSCRIBE, topic_a, 1));
|
2018-02-25 20:20:44 +00:00
|
|
|
|
|
|
|
// XSUB only sends unsub if it matched it in its trie, IOW: it will only
|
|
|
|
// send it if it existed in the first place even with XPUB_VERBBOSER
|
2018-08-22 10:54:24 +02:00
|
|
|
TEST_ASSERT_FAILURE_ERRNO (EAGAIN, zmq_recv (pub, NULL, 0, ZMQ_DONTWAIT));
|
2018-02-25 20:20:44 +00:00
|
|
|
|
|
|
|
// Clean up.
|
2018-08-22 10:54:24 +02:00
|
|
|
test_context_socket_close (pub);
|
|
|
|
test_context_socket_close (sub);
|
2018-02-25 20:20:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void test_xpub_verboser_two_subs ()
|
|
|
|
{
|
2018-08-20 16:14:46 +02:00
|
|
|
void *pub, *sub0, *sub1;
|
2018-08-22 10:54:24 +02:00
|
|
|
create_xpub_with_2_subs (&pub, &sub0, &sub1);
|
2018-08-20 16:14:46 +02:00
|
|
|
create_duplicate_subscription (pub, sub0, sub1);
|
2018-02-25 20:20:44 +00:00
|
|
|
|
|
|
|
// Unsubscribe for A, this time it exists in XPUB
|
2018-08-22 10:54:24 +02:00
|
|
|
TEST_ASSERT_SUCCESS_ERRNO (
|
|
|
|
zmq_setsockopt (sub0, ZMQ_UNSUBSCRIBE, topic_a, 1));
|
2018-02-25 20:20:44 +00:00
|
|
|
|
|
|
|
// sub1 is still subscribed, so no notification
|
2018-08-22 10:54:24 +02:00
|
|
|
TEST_ASSERT_FAILURE_ERRNO (EAGAIN, zmq_recv (pub, NULL, 0, ZMQ_DONTWAIT));
|
2018-02-25 20:20:44 +00:00
|
|
|
|
|
|
|
// Unsubscribe the second socket to trigger the notification
|
2018-08-22 10:54:24 +02:00
|
|
|
TEST_ASSERT_SUCCESS_ERRNO (
|
|
|
|
zmq_setsockopt (sub1, ZMQ_UNSUBSCRIBE, topic_a, 1));
|
2018-02-25 20:20:44 +00:00
|
|
|
|
|
|
|
// Receive unsubscriptions since all sockets are gone
|
2018-08-22 10:54:24 +02:00
|
|
|
recv_array_expect_success (pub, unsubscribe_a_msg, 0);
|
2018-02-25 20:20:44 +00:00
|
|
|
|
|
|
|
// Make really sure there is only one notification
|
2018-08-22 10:54:24 +02:00
|
|
|
TEST_ASSERT_FAILURE_ERRNO (EAGAIN, zmq_recv (pub, NULL, 0, ZMQ_DONTWAIT));
|
2018-02-25 20:20:44 +00:00
|
|
|
|
|
|
|
int verbose = 1;
|
2018-08-22 10:54:24 +02:00
|
|
|
TEST_ASSERT_SUCCESS_ERRNO (
|
|
|
|
zmq_setsockopt (pub, ZMQ_XPUB_VERBOSER, &verbose, sizeof (int)));
|
2018-02-25 20:20:44 +00:00
|
|
|
|
|
|
|
// Subscribe socket for A again
|
2018-08-22 10:54:24 +02:00
|
|
|
TEST_ASSERT_SUCCESS_ERRNO (
|
|
|
|
zmq_setsockopt (sub0, ZMQ_SUBSCRIBE, topic_a, 1));
|
2018-02-25 20:20:44 +00:00
|
|
|
|
|
|
|
// Subscribe socket for A again
|
2018-08-22 10:54:24 +02:00
|
|
|
TEST_ASSERT_SUCCESS_ERRNO (
|
|
|
|
zmq_setsockopt (sub1, ZMQ_SUBSCRIBE, topic_a, 1));
|
2018-02-25 20:20:44 +00:00
|
|
|
|
|
|
|
// Receive subscriptions from subscriber, did not exist anymore
|
2018-08-22 10:54:24 +02:00
|
|
|
recv_array_expect_success (pub, subscribe_a_msg, 0);
|
2018-02-25 20:20:44 +00:00
|
|
|
|
|
|
|
// VERBOSER is set, so subs from both sockets are received
|
2018-08-22 10:54:24 +02:00
|
|
|
recv_array_expect_success (pub, subscribe_a_msg, 0);
|
2018-02-25 20:20:44 +00:00
|
|
|
|
|
|
|
// Sending A message to make sure everything still works
|
2018-08-22 10:54:24 +02:00
|
|
|
send_string_expect_success (pub, topic_a, 0);
|
2018-02-25 20:20:44 +00:00
|
|
|
|
2018-08-22 10:54:24 +02:00
|
|
|
recv_string_expect_success (sub0, topic_a, 0);
|
|
|
|
recv_string_expect_success (sub1, topic_a, 0);
|
2018-02-25 20:20:44 +00:00
|
|
|
|
|
|
|
// Unsubscribe for A
|
2018-08-22 10:54:24 +02:00
|
|
|
TEST_ASSERT_SUCCESS_ERRNO (
|
|
|
|
zmq_setsockopt (sub1, ZMQ_UNSUBSCRIBE, topic_a, 1));
|
2018-02-25 20:20:44 +00:00
|
|
|
|
|
|
|
// Receive unsubscriptions from first subscriber due to VERBOSER
|
2018-08-22 10:54:24 +02:00
|
|
|
recv_array_expect_success (pub, unsubscribe_a_msg, 0);
|
2018-02-25 20:20:44 +00:00
|
|
|
|
|
|
|
// Unsubscribe for A again from the other socket
|
2018-08-22 10:54:24 +02:00
|
|
|
TEST_ASSERT_SUCCESS_ERRNO (
|
|
|
|
zmq_setsockopt (sub0, ZMQ_UNSUBSCRIBE, topic_a, 1));
|
2018-02-25 20:20:44 +00:00
|
|
|
|
|
|
|
// Receive unsubscriptions from first subscriber due to VERBOSER
|
2018-08-22 10:54:24 +02:00
|
|
|
recv_array_expect_success (pub, unsubscribe_a_msg, 0);
|
2018-02-25 20:20:44 +00:00
|
|
|
|
|
|
|
// Unsubscribe again to make sure it gets filtered now
|
2018-08-22 10:54:24 +02:00
|
|
|
TEST_ASSERT_SUCCESS_ERRNO (
|
|
|
|
zmq_setsockopt (sub1, ZMQ_UNSUBSCRIBE, topic_a, 1));
|
2018-02-25 20:20:44 +00:00
|
|
|
|
|
|
|
// Unmatched, so XSUB filters even with VERBOSER
|
2018-08-22 10:54:24 +02:00
|
|
|
TEST_ASSERT_FAILURE_ERRNO (EAGAIN, zmq_recv (pub, NULL, 0, ZMQ_DONTWAIT));
|
2018-02-25 20:20:44 +00:00
|
|
|
|
|
|
|
// Clean up.
|
2018-08-22 10:54:24 +02:00
|
|
|
test_context_socket_close (pub);
|
|
|
|
test_context_socket_close (sub0);
|
|
|
|
test_context_socket_close (sub1);
|
2018-02-25 20:20:44 +00:00
|
|
|
}
|
|
|
|
|
2018-08-22 10:54:24 +02:00
|
|
|
int main ()
|
2018-02-25 20:20:44 +00:00
|
|
|
{
|
|
|
|
setup_test_environment ();
|
|
|
|
|
|
|
|
UNITY_BEGIN ();
|
|
|
|
RUN_TEST (test_xpub_verbose_one_sub);
|
|
|
|
RUN_TEST (test_xpub_verbose_two_subs);
|
|
|
|
RUN_TEST (test_xpub_verboser_one_sub);
|
|
|
|
RUN_TEST (test_xpub_verboser_two_subs);
|
|
|
|
|
2018-08-22 10:54:24 +02:00
|
|
|
return UNITY_END ();
|
2018-02-25 20:20:44 +00:00
|
|
|
}
|