From 03d85acfc7cb18a5469146f98c210a5747218cb3 Mon Sep 17 00:00:00 2001 From: hathach Date: Fri, 31 May 2013 18:21:31 +0700 Subject: refractor string descriptors, allow one-stop configure descriptor for - manufacturer, product etc ... (only english now) --- tests/test/device/usbd/test_usbd.c | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) (limited to 'tests/test/device') diff --git a/tests/test/device/usbd/test_usbd.c b/tests/test/device/usbd/test_usbd.c index 8054cab4d..05c338199 100644 --- a/tests/test/device/usbd/test_usbd.c +++ b/tests/test/device/usbd/test_usbd.c @@ -41,6 +41,8 @@ #include "errors.h" #include "type_helper.h" +#include "tusb_descriptors.h" + #include "mock_dcd.h" #include "usbd.h" @@ -71,3 +73,37 @@ void test_usbd_init_ok(void) TEST_ASSERT_EQUAL( TUSB_ERROR_NONE, usbd_init() ); } + +void test_usbd_string_descriptor(void) +{ + dcd_init_IgnoreAndReturn(TUSB_ERROR_FAILED); + + //------------- Code Under Test -------------// + TEST_ASSERT_EQUAL( TUSB_ERROR_FAILED, usbd_init() ); + + + //------------- manufacturer string descriptor -------------// + uint32_t const manufacturer_len = sizeof(TUSB_CFG_DEVICE_STRING_MANUFACTURER) - 1; + TEST_ASSERT_EQUAL(manufacturer_len*2 + 2, app_tusb_desc_strings.manufacturer.bLength); + for(uint32_t i=0; i