2023-06-05 01:16:05 +02:00
|
|
|
/* SPDX-License-Identifier: MPL-2.0 */
|
2013-10-30 16:03:27 +01:00
|
|
|
|
|
|
|
#include "testutil.hpp"
|
2018-12-07 13:51:30 +01:00
|
|
|
#include "testutil_unity.hpp"
|
2013-10-30 16:03:27 +01:00
|
|
|
|
2019-03-24 17:51:28 +01:00
|
|
|
SETUP_TEARDOWN_TESTCONTEXT
|
2013-10-30 16:03:27 +01:00
|
|
|
|
2018-12-07 13:51:30 +01:00
|
|
|
void test_roundtrip ()
|
|
|
|
{
|
|
|
|
void *sb = test_context_socket (ZMQ_REP);
|
|
|
|
TEST_ASSERT_SUCCESS_ERRNO (zmq_bind (sb, "tipc://{5560,0,0}"));
|
2013-10-30 16:03:27 +01:00
|
|
|
|
2018-12-07 13:51:30 +01:00
|
|
|
void *sc = test_context_socket (ZMQ_REQ);
|
|
|
|
TEST_ASSERT_SUCCESS_ERRNO (zmq_connect (sc, "tipc://{5560,0}@0.0.0"));
|
2013-10-30 16:03:27 +01:00
|
|
|
|
|
|
|
bounce (sb, sc);
|
|
|
|
|
2018-12-07 13:51:30 +01:00
|
|
|
test_context_socket_close (sc);
|
|
|
|
test_context_socket_close (sb);
|
|
|
|
}
|
2013-10-30 16:03:27 +01:00
|
|
|
|
2018-12-07 13:51:30 +01:00
|
|
|
int main (void)
|
|
|
|
{
|
|
|
|
if (!is_tipc_available ()) {
|
|
|
|
printf ("TIPC environment unavailable, skipping test\n");
|
|
|
|
return 77;
|
|
|
|
}
|
2013-10-30 16:03:27 +01:00
|
|
|
|
2018-12-07 13:51:30 +01:00
|
|
|
UNITY_BEGIN ();
|
|
|
|
RUN_TEST (test_roundtrip);
|
2013-10-30 16:03:27 +01:00
|
|
|
|
2018-12-07 13:51:30 +01:00
|
|
|
return UNITY_END ();
|
2013-10-30 16:03:27 +01:00
|
|
|
}
|