mirror of
https://github.com/zeromq/libzmq.git
synced 2025-03-10 16:06:09 +00:00
Problem: code from bind_loopback_tipc is duplicated
Solution: call bind_loopback_tipc where applicable
This commit is contained in:
parent
0e0bead3cf
commit
386de33030
@ -28,6 +28,8 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "testutil.hpp"
|
#include "testutil.hpp"
|
||||||
|
#include "testutil_unity.hpp"
|
||||||
|
|
||||||
#include <unity.h>
|
#include <unity.h>
|
||||||
|
|
||||||
|
|
||||||
@ -68,7 +70,6 @@ void test_tipc_port_name_and_domain ()
|
|||||||
void test_tipc_port_identity ()
|
void test_tipc_port_identity ()
|
||||||
{
|
{
|
||||||
char endpoint[256];
|
char endpoint[256];
|
||||||
size_t size = 256;
|
|
||||||
unsigned int z, c, n, ref;
|
unsigned int z, c, n, ref;
|
||||||
|
|
||||||
void *ctx = zmq_ctx_new ();
|
void *ctx = zmq_ctx_new ();
|
||||||
@ -80,15 +81,11 @@ void test_tipc_port_identity ()
|
|||||||
void *sc = zmq_socket (ctx, ZMQ_REQ);
|
void *sc = zmq_socket (ctx, ZMQ_REQ);
|
||||||
TEST_ASSERT_NOT_NULL (sc);
|
TEST_ASSERT_NOT_NULL (sc);
|
||||||
|
|
||||||
// Test binding to random Port Identity
|
// Test binding to random Port Identity and
|
||||||
int rc = zmq_bind (sb, "tipc://<*>");
|
// test resolving assigned address, should return a properly formatted string
|
||||||
TEST_ASSERT_EQUAL_INT (0, rc);
|
bind_loopback_tipc (sb, endpoint, sizeof endpoint);
|
||||||
|
|
||||||
// Test resolving assigned address, should return a properly formatted string
|
int rc = sscanf (&endpoint[0], "tipc://<%u.%u.%u:%u>", &z, &c, &n, &ref);
|
||||||
rc = zmq_getsockopt (sb, ZMQ_LAST_ENDPOINT, &endpoint[0], &size);
|
|
||||||
TEST_ASSERT_EQUAL_INT (0, rc);
|
|
||||||
|
|
||||||
rc = sscanf (&endpoint[0], "tipc://<%u.%u.%u:%u>", &z, &c, &n, &ref);
|
|
||||||
TEST_ASSERT_EQUAL_INT (4, rc);
|
TEST_ASSERT_EQUAL_INT (4, rc);
|
||||||
|
|
||||||
TEST_ASSERT_NOT_EQUAL_MESSAGE (
|
TEST_ASSERT_NOT_EQUAL_MESSAGE (
|
||||||
|
Loading…
x
Reference in New Issue
Block a user