From 6d957b0aa251fcd1f1ad44993b7ae857af9d6345 Mon Sep 17 00:00:00 2001 From: Lukasz Rymanowski Date: Mon, 3 Nov 2014 10:36:01 +0100 Subject: [PATCH] unit/test-hfp: Test for skip hfp_context field This patch adds test: /hfp_hf/test_context_skip_field --- unit/test-hfp.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/unit/test-hfp.c b/unit/test-hfp.c index 617b33664..ef8a1008b 100644 --- a/unit/test-hfp.c +++ b/unit/test-hfp.c @@ -556,6 +556,23 @@ static void hf_chld_result_handler(struct hfp_context *hf_context, hfp_hf_disconnect(context->hfp_hf); } +static void hf_chld_skip_field(struct hfp_context *hf_context, + void *user_data) +{ + struct context *context = user_data; + char str[3]; + + g_assert(hf_context); + + hfp_context_skip_field(hf_context); + + g_assert(hfp_context_get_unquoted_string(hf_context, str, + sizeof(str))); + g_assert_cmpstr(str, ==, "2x"); + + hfp_hf_disconnect(context->hfp_hf); +} + static void hf_clcc_result_handler(struct hfp_context *hf_context, void *user_data) { @@ -801,5 +818,12 @@ int main(int argc, char *argv[]) frg_pdu('1', ',', '2', 'x', '\r', '\n'), data_end()); + define_hf_test("/hfp_hf/test_context_skip_field", test_hf_unsolicited, + hf_chld_skip_field, NULL, + raw_pdu('+', 'C', 'H', 'L', 'D', '\0'), + frg_pdu('+', 'C', 'H', 'L', 'D', ':'), + frg_pdu('1', ',', '2', 'x', '\r', '\n'), + data_end()); + return g_test_run(); } -- 2.47.3