mirror of
https://github.com/zeromq/libzmq.git
synced 2025-10-28 19:52:00 +01:00
Migrate tests/test_bind_src_address.cpp to unity
This commit is contained in:
@@ -28,30 +28,39 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "testutil.hpp"
|
#include "testutil.hpp"
|
||||||
|
#include "testutil_unity.hpp"
|
||||||
|
|
||||||
|
#include <unity.h>
|
||||||
|
|
||||||
|
void setUp ()
|
||||||
|
{
|
||||||
|
setup_test_context ();
|
||||||
|
}
|
||||||
|
|
||||||
|
void tearDown ()
|
||||||
|
{
|
||||||
|
teardown_test_context ();
|
||||||
|
}
|
||||||
|
|
||||||
|
void test_x ()
|
||||||
|
{
|
||||||
|
void *sock = test_context_socket (ZMQ_PUB);
|
||||||
|
|
||||||
|
TEST_ASSERT_SUCCESS_ERRNO (
|
||||||
|
zmq_connect (sock, "tcp://127.0.0.1:0;localhost:1234"));
|
||||||
|
TEST_ASSERT_SUCCESS_ERRNO (
|
||||||
|
zmq_connect (sock, "tcp://localhost:5555;localhost:1235"));
|
||||||
|
TEST_ASSERT_SUCCESS_ERRNO (
|
||||||
|
zmq_connect (sock, "tcp://lo:5555;localhost:1235"));
|
||||||
|
|
||||||
|
test_context_socket_close (sock);
|
||||||
|
}
|
||||||
|
|
||||||
int main (void)
|
int main (void)
|
||||||
{
|
{
|
||||||
setup_test_environment ();
|
setup_test_environment ();
|
||||||
void *ctx = zmq_ctx_new ();
|
|
||||||
assert (ctx);
|
|
||||||
|
|
||||||
void *sock = zmq_socket (ctx, ZMQ_PUB);
|
UNITY_BEGIN ();
|
||||||
assert (sock);
|
RUN_TEST (test_x);
|
||||||
|
return UNITY_END ();
|
||||||
int rc = zmq_connect (sock, "tcp://127.0.0.1:0;localhost:1234");
|
|
||||||
assert (rc == 0);
|
|
||||||
|
|
||||||
rc = zmq_connect (sock, "tcp://localhost:5555;localhost:1235");
|
|
||||||
assert (rc == 0);
|
|
||||||
|
|
||||||
rc = zmq_connect (sock, "tcp://lo:5555;localhost:1235");
|
|
||||||
assert (rc == 0);
|
|
||||||
|
|
||||||
rc = zmq_close (sock);
|
|
||||||
assert (rc == 0);
|
|
||||||
|
|
||||||
rc = zmq_ctx_term (ctx);
|
|
||||||
assert (rc == 0);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user