From 1d121483f6a8b1f1b738794eea118986fe116ff9 Mon Sep 17 00:00:00 2001 From: Neels Hofmeyr Date: Mon, 3 Sep 2018 21:05:13 +0200 Subject: [PATCH] mgcp_client_test: cosmetically re-arrange reply_to() args I want to test arbitrary length Conn IDs ('I:'), and hence don't want to pass the conn_id as int, but rather just include it in the message string. Prepare for that by eliminating the extra conn_id arg and just pass a params string. Change-Id: Ib2e718dda3aa1f6e9979dee823d973dd002e2318 --- tests/mgcp_client/mgcp_client_test.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/tests/mgcp_client/mgcp_client_test.c b/tests/mgcp_client/mgcp_client_test.c index 2662fc12a..84ba3b446 100644 --- a/tests/mgcp_client/mgcp_client_test.c +++ b/tests/mgcp_client/mgcp_client_test.c @@ -77,14 +77,14 @@ static struct mgcp_client_conf conf; struct mgcp_client *mgcp = NULL; static int reply_to(mgcp_trans_id_t trans_id, int code, const char *comment, - int conn_id, const char *params) + const char *params) { static char compose[4096 - 128]; int len; len = snprintf(compose, sizeof(compose), - "%d %u %s\r\nI: %d\n\n%s", - code, trans_id, comment, conn_id, params); + "%d %u %s\r\n%s", + code, trans_id, comment, params); OSMO_ASSERT(len < sizeof(compose)); OSMO_ASSERT(len > 0); @@ -148,7 +148,8 @@ void test_crcx(void) msg = mgcp_msg_crcx(mgcp, 23, 42, MGCP_CONN_LOOPBACK); trans_id = dummy_mgcp_send(msg); - reply_to(trans_id, 200, "OK", 1, + reply_to(trans_id, 200, "OK", + "I: 1\n\n" "v=0\r\n" "o=- 1 23 IN IP4 10.9.1.120\r\n" "s=-\r\n" @@ -335,7 +336,7 @@ void test_mgcp_client_cancel() OSMO_ASSERT(mgcp_client_cancel(mgcp, trans_id) == 0); fprintf(stderr, "- late response gets discarded\n"); - OSMO_ASSERT(reply_to(trans_id, 200, "OK", 1, "v=0\r\n") == -ENOENT); + OSMO_ASSERT(reply_to(trans_id, 200, "OK", "I: 1\n\nv=0\r\n") == -ENOENT); fprintf(stderr, "- canceling again does nothing\n"); OSMO_ASSERT(mgcp_client_cancel(mgcp, trans_id) == -ENOENT);