diff options
| author | hathach <[email protected]> | 2013-07-02 15:39:53 +0700 |
|---|---|---|
| committer | hathach <[email protected]> | 2013-07-02 15:39:53 +0700 |
| commit | 51f894b0bf31fd046cca6251679b188bed3e3024 (patch) | |
| tree | 56c181fbe51e40942cd15dc26efac2575f41dc8f | |
| parent | 7e5c6ded2d8e81912623ac866ba0a3a9f4142abc (diff) | |
add tests for tusbh_cdc_serial_is_mounted
| -rw-r--r-- | tests/lpc18xx_43xx/test/host/cdc/test_cdc_host.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/lpc18xx_43xx/test/host/cdc/test_cdc_host.c b/tests/lpc18xx_43xx/test/host/cdc/test_cdc_host.c index 8bd1d46b7..ffb1dc296 100644 --- a/tests/lpc18xx_43xx/test/host/cdc/test_cdc_host.c +++ b/tests/lpc18xx_43xx/test/host/cdc/test_cdc_host.c @@ -188,6 +188,35 @@ void test_cdch_close_device(void) cdch_close(dev_addr); } +void test_cdc_serial_is_mounted_not_configured(void) +{ + tusbh_device_get_mounted_class_flag_ExpectAndReturn(dev_addr, 0); + + TEST_ASSERT_FALSE( tusbh_cdc_serial_is_mounted(dev_addr) ); +} + +void test_cdc_serial_is_mounted_protocol_zero(void) +{ + tusbh_device_get_mounted_class_flag_ExpectAndReturn(dev_addr, BIT_(TUSB_CLASS_CDC) ); + cdch_data[0].interface_protocol = 0; + + TEST_ASSERT_FALSE( tusbh_cdc_serial_is_mounted(dev_addr) ); +} +void test_cdc_serial_is_mounted_protocol_is_vendor(void) +{ + tusbh_device_get_mounted_class_flag_ExpectAndReturn(dev_addr, BIT_(TUSB_CLASS_CDC) ); + cdch_data[0].interface_protocol = 0xff; + + TEST_ASSERT_FALSE( tusbh_cdc_serial_is_mounted(dev_addr) ); +} + +void test_cdc_serial_is_mounted_protocol_is_at_command(void) +{ + tusbh_device_get_mounted_class_flag_ExpectAndReturn(dev_addr, BIT_(TUSB_CLASS_CDC) ); + cdch_data[0].interface_protocol = CDC_COMM_PROTOCOL_ATCOMMAND; + + TEST_ASSERT( tusbh_cdc_serial_is_mounted(dev_addr) ); +} |
