summaryrefslogtreecommitdiff
path: root/unit/test-hfp.c
diff options
context:
space:
mode:
authorLukasz Rymanowski <lukasz.rymanowski@tieto.com>2014-11-20 16:55:11 +0100
committerSzymon Janc <szymon.janc@tieto.com>2014-11-24 12:56:39 +0100
commit8d4261c86433723e7b7531f81e2e8865b96b13ea (patch)
tree3a99121b7834b4afef0ad63871bfefbe0625d90e /unit/test-hfp.c
parent8ad6a853f07554f1a1a56f339d01f50e6da4c628 (diff)
downloadbluez-8d4261c86433723e7b7531f81e2e8865b96b13ea.tar.gz
unit/test-hfp: Add test for reading \rAT+X\r
Diffstat (limited to 'unit/test-hfp.c')
-rw-r--r--unit/test-hfp.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/unit/test-hfp.c b/unit/test-hfp.c
index ef8a1008b..b22b8a535 100644
--- a/unit/test-hfp.c
+++ b/unit/test-hfp.c
@@ -453,6 +453,19 @@ static void check_string_2(struct hfp_context *result,
hfp_gw_send_result(context->hfp, HFP_RESULT_ERROR);
}
+static void check_string_3(struct hfp_context *result,
+ enum hfp_gw_cmd_type type, void *user_data)
+{
+ struct context *context = user_data;
+ const struct test_pdu *pdu;
+
+ pdu = &context->data->pdu_list[context->pdu_offset++];
+
+ g_assert(type == pdu->type);
+
+ hfp_gw_send_result(context->hfp, HFP_RESULT_ERROR);
+}
+
static void test_hf_init(gconstpointer data)
{
struct context *context = create_context(data);
@@ -725,10 +738,15 @@ int main(int argc, char *argv[])
'\r'),
type_pdu(HFP_GW_CMD_TYPE_SET, 0),
data_end());
+ define_test("/hfp/test_corrupted_1", test_register, check_string_3,
+ raw_pdu('D', '\0'),
+ raw_pdu('\r', 'A', 'T', 'D', '\"', '0', '1', '2', '3',
+ '\"', '\r'),
+ type_pdu(HFP_GW_CMD_TYPE_SET, 0),
+ data_end());
define_test("/hfp/test_empty", test_fragmented, NULL,
raw_pdu('\r'),
data_end());
-
define_hf_test("/hfp_hf/test_init", test_hf_init, NULL, NULL,
data_end());
define_hf_test("/hfp_hf/test_send_command_1", test_hf_send_command,