From 59c916269c300ae7765a2c7b0fe6b74efe760af2 Mon Sep 17 00:00:00 2001 From: Johan Hedberg Date: Wed, 30 Jul 2014 11:27:07 +0300 Subject: [PATCH] mgmt-tester: Add invalid params tests for Add Device --- tools/mgmt-tester.c | 56 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) diff --git a/tools/mgmt-tester.c b/tools/mgmt-tester.c index 99c36acdc..c99a06649 100644 --- a/tools/mgmt-tester.c +++ b/tools/mgmt-tester.c @@ -2906,6 +2906,52 @@ static const struct generic_data load_conn_params_fail_1 = { .expect_status = MGMT_STATUS_INVALID_PARAMS, }; +static const uint8_t add_device_nval_1[] = { + 0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, + 0x00, + 0x00, +}; +static const uint8_t add_device_rsp[] = { + 0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, + 0x00, +}; +static const struct generic_data add_device_fail_1 = { + .send_opcode = MGMT_OP_ADD_DEVICE, + .send_param = add_device_nval_1, + .send_len = sizeof(add_device_nval_1), + .expect_param = add_device_rsp, + .expect_len = sizeof(add_device_rsp), + .expect_status = MGMT_STATUS_INVALID_PARAMS, +}; + +static const uint8_t add_device_nval_2[] = { + 0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, + 0x00, + 0x02, +}; +static const struct generic_data add_device_fail_2 = { + .send_opcode = MGMT_OP_ADD_DEVICE, + .send_param = add_device_nval_2, + .send_len = sizeof(add_device_nval_2), + .expect_param = add_device_rsp, + .expect_len = sizeof(add_device_rsp), + .expect_status = MGMT_STATUS_INVALID_PARAMS, +}; + +static const uint8_t add_device_nval_3[] = { + 0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, + 0x00, + 0xff, +}; +static const struct generic_data add_device_fail_3 = { + .send_opcode = MGMT_OP_ADD_DEVICE, + .send_param = add_device_nval_3, + .send_len = sizeof(add_device_nval_3), + .expect_param = add_device_rsp, + .expect_len = sizeof(add_device_rsp), + .expect_status = MGMT_STATUS_INVALID_PARAMS, +}; + static void client_cmd_complete(uint16_t opcode, uint8_t status, const void *param, uint8_t len, void *user_data) @@ -4274,5 +4320,15 @@ int main(int argc, char *argv[]) &load_conn_params_fail_1, NULL, test_command_generic); + test_bredrle("Add Device - Invalid Params 1", + &add_device_fail_1, + NULL, test_command_generic); + test_bredrle("Add Device - Invalid Params 2", + &add_device_fail_2, + NULL, test_command_generic); + test_bredrle("Add Device - Invalid Params 3", + &add_device_fail_3, + NULL, test_command_generic); + return tester_run(); } -- 2.47.3