const btsock_interface_t *if_sock;
const bthh_interface_t *if_hid;
- bool mgmt_settings_set;
- bool cb_count_checked;
- bool status_checked;
- bool property_checked;
+ int conditions_left;
/* Set to true if test conditions are initialized */
bool test_init_done;
+ bool test_result_set;
+
int cb_count;
GSList *expected_properties_list;
};
{
struct test_data *data = tester_get_data();
- if (!(data->cb_count_checked))
- return;
- if (!(data->mgmt_settings_set))
- return;
- if (!(data->status_checked))
- return;
- if (!(data->property_checked))
- return;
- tester_test_passed();
+ if (data->conditions_left == 0 && !data->test_result_set) {
+ data->test_result_set = true;
+ tester_test_passed();
+ }
}
static void test_mgmt_settings_set(struct test_data *data)
{
- data->mgmt_settings_set = true;
+ data->conditions_left--;
test_update_state();
}
return;
if (data->cb_count == 0) {
- data->cb_count_checked = true;
+ data->conditions_left--;
test_update_state();
}
}
const struct generic_data *test_data = data->test_data;
if (test_data->expected_adapter_status == BT_STATUS_NOT_EXPECTED)
- data->status_checked = true;
+ data->conditions_left--;
}
static void test_property_init(struct test_data *data)
GSList *l = data->expected_properties_list;
int i;
- if (!test_data->expected_hal_cb.adapter_properties_cb) {
- data->property_checked = true;
+ if (!test_data->expected_properties_num) {
+ data->conditions_left--;
return;
}
{
data->test_init_done = true;
+ data->conditions_left = 4;
+
expected_cb_count_init(data);
mgmt_cb_init(data);
expected_status_init(data);
const struct generic_data *test_data = data->test_data;
if (test_data->expected_adapter_status == status) {
- data->status_checked = true;
+ data->conditions_left--;
test_update_state();
} else
tester_test_failed();
GSList *l = data->expected_properties_list;
GSList *found_exp_prop;
+ if (!g_slist_length(l))
+ return;
+
found_exp_prop = g_slist_find_custom(l, &received_prop,
&locate_property);
if (g_slist_length(l))
return;
- data->property_checked = true;
+ data->conditions_left--;
test_update_state();
}
static bool check_test_property(bt_property_t received_prop,
bt_property_t expected_prop)
{
- struct test_data *data = tester_get_data();
-
if (expected_prop.type && (expected_prop.type != received_prop.type))
return false;
if (expected_prop.len && (expected_prop.len != received_prop.len))
expected_prop.len))
return false;
- return data->property_checked = true;
+ return true;
}
static void read_info_callback(uint8_t status, uint16_t length,
init_test_conditions(data);
adapter_status = data->if_bluetooth->set_adapter_property(prop);
- check_expected_status(adapter_status);
adapter_status = data->if_bluetooth->get_adapter_property((*prop).type);
check_expected_status(adapter_status);