diff options
author | Andrei Emeltchenko <andrei.emeltchenko@intel.com> | 2014-02-04 13:44:54 +0200 |
---|---|---|
committer | Luiz Augusto von Dentz <luiz.von.dentz@intel.com> | 2014-02-04 15:09:12 +0200 |
commit | 377c1df2cb9a10181d38b6ce7f210e8bb64e6889 (patch) | |
tree | 417729e88d1500ff24ae39137e833a7c012cc398 /unit/test-avctp.c | |
parent | 0f7baebb9e77f1a7a054c7417239fec293cc12e2 (diff) | |
download | bluez-377c1df2cb9a10181d38b6ce7f210e8bb64e6889.tar.gz |
unit/AVCTP: Add test TP/NFR/BV-03-C
The test verifies that IUT (TG) correctly reports the parameters of the
incoming command in the handler callback.
Diffstat (limited to 'unit/test-avctp.c')
-rw-r--r-- | unit/test-avctp.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/unit/test-avctp.c b/unit/test-avctp.c index c0d16a4c9..6d7e34a4d 100644 --- a/unit/test-avctp.c +++ b/unit/test-avctp.c @@ -249,10 +249,35 @@ static void test_client(gconstpointer data) execute_context(context); } +static size_t handler(struct avctp *session, + uint8_t transaction, uint8_t *code, + uint8_t *subunit, uint8_t *operands, + size_t operand_count, void *user_data) +{ + DBG("transaction %d code %d subunit %d operand_count %zu", + transaction, *code, *subunit, operand_count); + + g_assert_cmpint(transaction, ==, 0); + g_assert_cmpint(*code, ==, 0); + g_assert_cmpint(*subunit, ==, 0); + g_assert_cmpint(operand_count, ==, 0); + + return operand_count; +} + static void test_server(gconstpointer data) { struct context *context = create_context(0x0100, data); + if (g_str_equal(context->data->test_name, "/TP/NFR/BV-03-C")) { + int ret; + + ret = avctp_register_pdu_handler(context->session, 0x00, + handler, NULL); + DBG("ret %d", ret); + g_assert_cmpint(ret, !=, 0); + } + g_idle_add(send_pdu, context); execute_context(context); @@ -284,6 +309,8 @@ int main(int argc, char *argv[]) define_test("/TP/CCM/BV-03-C", test_dummy, raw_pdu(0x00)); define_test("/TP/CCM/BV-04-C", test_dummy, raw_pdu(0x00)); + /* Non-Fragmented Messages tests */ + define_test("/TP/NFR/BV-01-C", test_client, raw_pdu(0x00, 0x11, 0x0e, 0x00, 0x00, 0x00)); @@ -291,6 +318,10 @@ int main(int argc, char *argv[]) raw_pdu(0x00, 0x11, 0x0e, 0x00, 0x00, 0x00), raw_pdu(0x02, 0x11, 0x0e, 0x0a, 0x00, 0x00)); + define_test("/TP/NFR/BV-03-C", test_server, + raw_pdu(0x00, 0x11, 0x0e, 0x00, 0x00, 0x00), + raw_pdu(0x02, 0x11, 0x0e, 0x00, 0x00, 0x00)); + define_test("/TP/NFR/BI-01-C", test_server, raw_pdu(0x00, 0xff, 0xff, 0x00, 0x00, 0x00), raw_pdu(0x03, 0xff, 0xff)); |