Commit 0114572c authored by Simon Giesecke's avatar Simon Giesecke

Migrate tests/test_bind_src_address.cpp to unity

parent be33dce6
......@@ -28,30 +28,39 @@
*/
#include "testutil.hpp"
#include "testutil_unity.hpp"
int main (void)
{
setup_test_environment ();
void *ctx = zmq_ctx_new ();
assert (ctx);
#include <unity.h>
void *sock = zmq_socket (ctx, ZMQ_PUB);
assert (sock);
void setUp ()
{
setup_test_context ();
}
int rc = zmq_connect (sock, "tcp://127.0.0.1:0;localhost:1234");
assert (rc == 0);
void tearDown ()
{
teardown_test_context ();
}
rc = zmq_connect (sock, "tcp://localhost:5555;localhost:1235");
assert (rc == 0);
void test_x ()
{
void *sock = test_context_socket (ZMQ_PUB);
rc = zmq_connect (sock, "tcp://lo:5555;localhost:1235");
assert (rc == 0);
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"));
rc = zmq_close (sock);
assert (rc == 0);
test_context_socket_close (sock);
}
rc = zmq_ctx_term (ctx);
assert (rc == 0);
int main (void)
{
setup_test_environment ();
return 0;
UNITY_BEGIN ();
RUN_TEST (test_x);
return UNITY_END ();
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment