OSDN Git Service

tools/mgmt-tester: Add test cases for enabling high speed
authorMarcel Holtmann <marcel@holtmann.org>
Tue, 1 Oct 2013 05:02:59 +0000 (22:02 -0700)
committerMarcel Holtmann <marcel@holtmann.org>
Tue, 1 Oct 2013 05:03:59 +0000 (22:03 -0700)
tools/mgmt-tester.c

index 4c481a1..8eacb39 100644 (file)
@@ -945,6 +945,49 @@ static const struct generic_data set_ssp_on_invalid_index_test = {
        .expect_status = MGMT_STATUS_INVALID_INDEX,
 };
 
+static const char set_hs_on_param[] = { 0x01 };
+static const char set_hs_invalid_param[] = { 0x02 };
+static const char set_hs_garbage_param[] = { 0x01, 0x00 };
+static const char set_hs_settings_param_1[] = { 0x80, 0x01, 0x00, 0x00 };
+static const char set_hs_settings_param_2[] = { 0x81, 0x01, 0x00, 0x00 };
+
+static const struct generic_data set_hs_on_success_test = {
+       .send_opcode = MGMT_OP_SET_HS,
+       .send_param = set_hs_on_param,
+       .send_len = sizeof(set_hs_on_param),
+       .expect_status = MGMT_STATUS_SUCCESS,
+       .expect_param = set_hs_settings_param_1,
+       .expect_len = sizeof(set_hs_settings_param_1),
+       .expect_settings_set = MGMT_SETTING_HS,
+};
+
+static const struct generic_data set_hs_on_invalid_param_test_1 = {
+       .send_opcode = MGMT_OP_SET_HS,
+       .expect_status = MGMT_STATUS_INVALID_PARAMS,
+};
+
+static const struct generic_data set_hs_on_invalid_param_test_2 = {
+       .send_opcode = MGMT_OP_SET_HS,
+       .send_param = set_hs_invalid_param,
+       .send_len = sizeof(set_hs_invalid_param),
+       .expect_status = MGMT_STATUS_INVALID_PARAMS,
+};
+
+static const struct generic_data set_hs_on_invalid_param_test_3 = {
+       .send_opcode = MGMT_OP_SET_HS,
+       .send_param = set_hs_garbage_param,
+       .send_len = sizeof(set_hs_garbage_param),
+       .expect_status = MGMT_STATUS_INVALID_PARAMS,
+};
+
+static const struct generic_data set_hs_on_invalid_index_test = {
+       .send_index_none = true,
+       .send_opcode = MGMT_OP_SET_HS,
+       .send_param = set_hs_on_param,
+       .send_len = sizeof(set_hs_on_param),
+       .expect_status = MGMT_STATUS_INVALID_INDEX,
+};
+
 static const char set_le_on_param[] = { 0x01 };
 static const char set_le_invalid_param[] = { 0x02 };
 static const char set_le_garbage_param[] = { 0x01, 0x00 };
@@ -2712,6 +2755,22 @@ int main(int argc, char *argv[])
                                &set_ssp_on_invalid_index_test,
                                NULL, test_command_generic);
 
+       test_bredrle("Set High Speed on - Success",
+                               &set_hs_on_success_test,
+                               NULL, test_command_generic);
+       test_bredrle("Set High Speed on - Invalid parameters 1",
+                               &set_hs_on_invalid_param_test_1,
+                               NULL, test_command_generic);
+       test_bredrle("Set High Speed on - Invalid parameters 2",
+                               &set_hs_on_invalid_param_test_2,
+                               NULL, test_command_generic);
+       test_bredrle("Set High Speed on - Invalid parameters 3",
+                               &set_hs_on_invalid_param_test_3,
+                               NULL, test_command_generic);
+       test_bredrle("Set High Speed on - Invalid index",
+                               &set_hs_on_invalid_index_test,
+                               NULL, test_command_generic);
+
        test_bredrle("Set Low Energy on - Success 1",
                                &set_le_on_success_test_1,
                                NULL, test_command_generic);