refractor test
This commit is contained in:
@@ -41,6 +41,7 @@
|
||||
#include "tusb_option.h"
|
||||
#include "errors.h"
|
||||
#include "binary.h"
|
||||
#include "type_helper.h"
|
||||
|
||||
#include "hal.h"
|
||||
#include "mock_osal.h"
|
||||
@@ -93,8 +94,7 @@ void setUp(void)
|
||||
memclr_(usbh_devices, sizeof(usbh_device_info_t)*(TUSB_CFG_HOST_DEVICE_MAX+1));
|
||||
memclr_(xfer_data, sizeof(xfer_data));
|
||||
|
||||
TEST_ASSERT_EQUAL( TUSB_ERROR_NONE,
|
||||
hcd_init() );
|
||||
TEST_ASSERT_STATUS( hcd_init() );
|
||||
|
||||
dev_addr = 1;
|
||||
hostid = RANDOM(CONTROLLER_HOST_NUMBER) + TEST_CONTROLLER_HOST_START_INDEX;
|
||||
@@ -148,8 +148,7 @@ void verify_qtd(ehci_qtd_t *p_qtd, uint8_t p_data[], uint16_t length)
|
||||
void test_interrupt_xfer(void)
|
||||
{
|
||||
//------------- Code Under Test -------------//
|
||||
TEST_ASSERT_EQUAL( TUSB_ERROR_NONE,
|
||||
hcd_pipe_xfer(pipe_hdl_interrupt, xfer_data, sizeof(xfer_data), true) );
|
||||
TEST_ASSERT_STATUS( hcd_pipe_xfer(pipe_hdl_interrupt, xfer_data, sizeof(xfer_data), true) );
|
||||
|
||||
ehci_qtd_t* p_qtd = p_qhd_interrupt->p_qtd_list_head;
|
||||
TEST_ASSERT_NOT_NULL(p_qtd);
|
||||
@@ -164,11 +163,9 @@ void test_interrupt_xfer(void)
|
||||
void test_interrupt_xfer_double(void)
|
||||
{
|
||||
//------------- Code Under Test -------------//
|
||||
TEST_ASSERT_EQUAL( TUSB_ERROR_NONE,
|
||||
hcd_pipe_xfer(pipe_hdl_interrupt, xfer_data, sizeof(xfer_data), false) );
|
||||
TEST_ASSERT_STATUS( hcd_pipe_xfer(pipe_hdl_interrupt, xfer_data, sizeof(xfer_data), false) );
|
||||
|
||||
TEST_ASSERT_EQUAL( TUSB_ERROR_NONE,
|
||||
hcd_pipe_xfer(pipe_hdl_interrupt, data2, sizeof(data2), true) );
|
||||
TEST_ASSERT_STATUS( hcd_pipe_xfer(pipe_hdl_interrupt, data2, sizeof(data2), true) );
|
||||
|
||||
ehci_qtd_t* p_head = p_qhd_interrupt->p_qtd_list_head;
|
||||
ehci_qtd_t* p_tail = p_qhd_interrupt->p_qtd_list_tail;
|
||||
@@ -199,11 +196,9 @@ void check_qhd_after_complete(ehci_qhd_t *p_qhd)
|
||||
|
||||
void test_interrupt_xfer_complete_isr_interval_less_than_1ms(void)
|
||||
{
|
||||
TEST_ASSERT_EQUAL( TUSB_ERROR_NONE,
|
||||
hcd_pipe_xfer(pipe_hdl_interrupt, xfer_data, sizeof(xfer_data), false) );
|
||||
TEST_ASSERT_STATUS( hcd_pipe_xfer(pipe_hdl_interrupt, xfer_data, sizeof(xfer_data), false) );
|
||||
|
||||
TEST_ASSERT_EQUAL( TUSB_ERROR_NONE,
|
||||
hcd_pipe_xfer(pipe_hdl_interrupt, data2, sizeof(data2), true) );
|
||||
TEST_ASSERT_STATUS( hcd_pipe_xfer(pipe_hdl_interrupt, data2, sizeof(data2), true) );
|
||||
|
||||
usbh_isr_Expect(pipe_hdl_interrupt, TUSB_CLASS_HID, TUSB_EVENT_XFER_COMPLETE);
|
||||
|
||||
@@ -226,8 +221,7 @@ void test_interrupt_xfer_complete_isr_interval_2ms(void)
|
||||
pipe_handle_t pipe_hdl_2ms = hcd_pipe_open(dev_addr, &desc_endpoint_2ms, TUSB_CLASS_HID);
|
||||
ehci_qhd_t * p_qhd_2ms = &ehci_data.device[ dev_addr -1].qhd[ pipe_hdl_2ms.index ];
|
||||
|
||||
TEST_ASSERT_EQUAL( TUSB_ERROR_NONE,
|
||||
hcd_pipe_xfer(pipe_hdl_2ms, xfer_data, sizeof(xfer_data), false) );
|
||||
TEST_ASSERT_STATUS( hcd_pipe_xfer(pipe_hdl_2ms, xfer_data, sizeof(xfer_data), false) );
|
||||
|
||||
ehci_qtd_t* p_head = p_qhd_2ms->p_qtd_list_head;
|
||||
ehci_qtd_t* p_tail = p_qhd_2ms->p_qtd_list_tail;
|
||||
|
||||
Reference in New Issue
Block a user