diff --git a/Makefile.am b/Makefile.am index c68f8041..edda5ff5 100644 --- a/Makefile.am +++ b/Makefile.am @@ -493,7 +493,8 @@ tests_test_immediate_LDADD = src/libzmq.la ${UNITY_LIBS} tests_test_immediate_CPPFLAGS = ${UNITY_CPPFLAGS} tests_test_last_endpoint_SOURCES = tests/test_last_endpoint.cpp -tests_test_last_endpoint_LDADD = src/libzmq.la +tests_test_last_endpoint_LDADD = src/libzmq.la ${UNITY_LIBS} +tests_test_last_endpoint_CPPFLAGS = ${UNITY_CPPFLAGS} tests_test_term_endpoint_SOURCES = tests/test_term_endpoint.cpp tests_test_term_endpoint_LDADD = src/libzmq.la diff --git a/tests/test_last_endpoint.cpp b/tests/test_last_endpoint.cpp index 502f567c..1255651e 100644 --- a/tests/test_last_endpoint.cpp +++ b/tests/test_last_endpoint.cpp @@ -28,6 +28,19 @@ */ #include "testutil.hpp" +#include "testutil_unity.hpp" + +#include + +void setUp () +{ + setup_test_context (); +} + +void tearDown () +{ + teardown_test_context (); +} static void do_bind_and_verify (void *s, const char *endpoint) { @@ -39,27 +52,24 @@ static void do_bind_and_verify (void *s, const char *endpoint) assert (rc == 0 && strcmp (reported, endpoint) == 0); } -int main (void) +void test_last_endpoint () { - setup_test_environment (); - // Create the infrastructure - void *ctx = zmq_ctx_new (); - assert (ctx); - - void *sb = zmq_socket (ctx, ZMQ_ROUTER); - assert (sb); + void *sb = test_context_socket (ZMQ_ROUTER); int val = 0; - int rc = zmq_setsockopt (sb, ZMQ_LINGER, &val, sizeof (val)); - assert (rc == 0); + TEST_ASSERT_SUCCESS_ERRNO ( + zmq_setsockopt (sb, ZMQ_LINGER, &val, sizeof (val))); do_bind_and_verify (sb, ENDPOINT_1); do_bind_and_verify (sb, ENDPOINT_2); - rc = zmq_close (sb); - assert (rc == 0); - - rc = zmq_ctx_term (ctx); - assert (rc == 0); - - return 0; + test_context_socket_close (sb); +} + +int main (void) +{ + setup_test_environment (); + + UNITY_BEGIN (); + RUN_TEST (test_last_endpoint); + return UNITY_END (); }