refractor
- rename usbh_device_info_t.status to state - rename enum TUSB_DEVICE_STATUS_* to TUSB_DEVICE_STATE_*
This commit is contained in:
@@ -100,11 +100,11 @@ void test_keyboard_no_instances_invalid_para(void)
|
||||
|
||||
void test_keyboard_install_ok(void)
|
||||
{
|
||||
tusbh_device_status_get_IgnoreAndReturn(TUSB_DEVICE_STATUS_READY);
|
||||
tusbh_device_status_get_IgnoreAndReturn(TUSB_DEVICE_STATE_READY);
|
||||
TEST_ASSERT_EQUAL(0, tusbh_hid_keyboard_no_instances(device_hdl));
|
||||
|
||||
TEST_ASSERT_EQUAL(TUSB_ERROR_NONE, hidh_keyboard_install(device_hdl, (uint8_t*) &kbd_descriptor));
|
||||
tusbh_device_status_get_IgnoreAndReturn(TUSB_DEVICE_STATUS_READY);
|
||||
tusbh_device_status_get_IgnoreAndReturn(TUSB_DEVICE_STATE_READY);
|
||||
TEST_ASSERT_EQUAL(1, tusbh_hid_keyboard_no_instances(device_hdl));
|
||||
}
|
||||
|
||||
@@ -150,7 +150,7 @@ pipe_status_t pipe_status_get_stub(pipe_handle_t pipe_hdl, int num_call)
|
||||
|
||||
void test_keyboard_get_invalid_para()
|
||||
{
|
||||
tusbh_device_status_get_IgnoreAndReturn(TUSB_DEVICE_STATUS_READY);
|
||||
tusbh_device_status_get_IgnoreAndReturn(TUSB_DEVICE_STATE_READY);
|
||||
TEST_ASSERT_EQUAL(TUSB_ERROR_INVALID_PARA, tusbh_hid_keyboard_get(0, 0, NULL));
|
||||
|
||||
tusbh_device_status_get_IgnoreAndReturn(0);
|
||||
@@ -162,18 +162,18 @@ void test_keyboard_get_invalid_para()
|
||||
|
||||
void test_keyboard_get_class_not_supported()
|
||||
{
|
||||
tusbh_device_status_get_IgnoreAndReturn(TUSB_DEVICE_STATUS_READY);
|
||||
tusbh_device_status_get_IgnoreAndReturn(TUSB_DEVICE_STATE_READY);
|
||||
keyboard_info_pool[device_hdl].instance[0].pipe_in = (pipe_handle_t) { 0 };
|
||||
TEST_ASSERT_EQUAL(TUSB_ERROR_CLASS_DEVICE_DONT_SUPPORT, tusbh_hid_keyboard_get(device_hdl, instance_num, &report));
|
||||
}
|
||||
|
||||
void test_keyboard_get_report_not_available()
|
||||
{
|
||||
tusbh_device_status_get_IgnoreAndReturn(TUSB_DEVICE_STATUS_READY);
|
||||
tusbh_device_status_get_IgnoreAndReturn(TUSB_DEVICE_STATE_READY);
|
||||
usbh_pipe_status_get_IgnoreAndReturn(PIPE_STATUS_BUSY);
|
||||
TEST_ASSERT_EQUAL(TUSB_ERROR_CLASS_DATA_NOT_AVAILABLE, tusbh_hid_keyboard_get(device_hdl, instance_num, &report));
|
||||
|
||||
tusbh_device_status_get_IgnoreAndReturn(TUSB_DEVICE_STATUS_READY);
|
||||
tusbh_device_status_get_IgnoreAndReturn(TUSB_DEVICE_STATE_READY);
|
||||
usbh_pipe_status_get_IgnoreAndReturn(PIPE_STATUS_AVAILABLE);
|
||||
TEST_ASSERT_EQUAL(TUSB_ERROR_CLASS_DATA_NOT_AVAILABLE, tusbh_hid_keyboard_get(device_hdl, instance_num, &report));
|
||||
}
|
||||
@@ -182,16 +182,16 @@ void test_keyboard_get_ok()
|
||||
{
|
||||
usbh_pipe_status_get_StubWithCallback(pipe_status_get_stub);
|
||||
|
||||
tusbh_device_status_get_IgnoreAndReturn(TUSB_DEVICE_STATUS_READY);
|
||||
tusbh_device_status_get_IgnoreAndReturn(TUSB_DEVICE_STATE_READY);
|
||||
TEST_ASSERT_EQUAL(TUSB_ERROR_NONE, tusbh_hid_keyboard_get(device_hdl, instance_num, &report));
|
||||
TEST_ASSERT_EQUAL_MEMORY(&sample_key[0], &report, sizeof(tusb_keyboard_report_t));
|
||||
|
||||
tusbh_device_status_get_IgnoreAndReturn(TUSB_DEVICE_STATUS_READY);
|
||||
tusbh_device_status_get_IgnoreAndReturn(TUSB_DEVICE_STATE_READY);
|
||||
TEST_ASSERT_EQUAL(TUSB_ERROR_CLASS_DATA_NOT_AVAILABLE, tusbh_hid_keyboard_get(device_hdl, instance_num, &report));
|
||||
tusbh_device_status_get_IgnoreAndReturn(TUSB_DEVICE_STATUS_READY);
|
||||
tusbh_device_status_get_IgnoreAndReturn(TUSB_DEVICE_STATE_READY);
|
||||
TEST_ASSERT_EQUAL(TUSB_ERROR_CLASS_DATA_NOT_AVAILABLE, tusbh_hid_keyboard_get(device_hdl, instance_num, &report));
|
||||
|
||||
tusbh_device_status_get_IgnoreAndReturn(TUSB_DEVICE_STATUS_READY);
|
||||
tusbh_device_status_get_IgnoreAndReturn(TUSB_DEVICE_STATE_READY);
|
||||
TEST_ASSERT_EQUAL(TUSB_ERROR_NONE, tusbh_hid_keyboard_get(device_hdl, instance_num, &report));
|
||||
TEST_ASSERT_EQUAL_MEMORY(&sample_key[1], &report, sizeof(tusb_keyboard_report_t));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user