summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorhathach <[email protected]>2013-01-27 12:18:01 +0700
committerhathach <[email protected]>2013-01-27 12:18:01 +0700
commit5feb1c90b41b2da4667b9e1f1fde069b6e1bfdcc (patch)
tree1f5cc4f36ffdb402b4a61c28aebafba6dedc3f6b /tests
parentd286c957655d432424c8a7ff509bd040fd773572 (diff)
add class_hid_keyboard_init and test code
add define _TINY_USB_SOURCE_FILE_ to hide internal API from application
Diffstat (limited to 'tests')
-rw-r--r--tests/project.yml1
-rw-r--r--tests/test/host/test_hid_host_keyboard.c12
2 files changed, 12 insertions, 1 deletions
diff --git a/tests/project.yml b/tests/project.yml
index be644f147..c33818a15 100644
--- a/tests/project.yml
+++ b/tests/project.yml
@@ -48,6 +48,7 @@
- MCU=MCU_LPC43XX
- CORE_M4
- __CODE_RED
+ - _TINY_USB_SOURCE_FILE_
:test_preprocess:
- *common_defines
- _TEST_
diff --git a/tests/test/host/test_hid_host_keyboard.c b/tests/test/host/test_hid_host_keyboard.c
index 39e4303ac..aab1636fe 100644
--- a/tests/test/host/test_hid_host_keyboard.c
+++ b/tests/test/host/test_hid_host_keyboard.c
@@ -90,7 +90,7 @@ void tearDown(void)
}
//--------------------------------------------------------------------+
-// keyboard_install, keyboard_no_instances
+// keyboard_install, keyboard_no_instances, keybaord_init
//--------------------------------------------------------------------+
void test_keyboard_no_instances_invalid_para(void)
{
@@ -107,6 +107,16 @@ void test_keyboard_install_ok(void)
TEST_ASSERT_EQUAL(1, tusbh_hid_keyboard_no_instances(device_hdl));
}
+void test_keyboard_init(void)
+{
+ class_hid_keyboard_info_t keyboard_info_zero[TUSB_CFG_HOST_DEVICE_MAX];
+ memset(&keyboard_info_zero, 0, sizeof(class_hid_keyboard_info_t)*TUSB_CFG_HOST_DEVICE_MAX);
+
+ class_hid_keyboard_init();
+
+ TEST_ASSERT_EQUAL_MEMORY(keyboard_info_zero, keyboard_info_pool, sizeof(class_hid_keyboard_info_t)*TUSB_CFG_HOST_DEVICE_MAX);
+}
+
//--------------------------------------------------------------------+
// keyboard_get
//--------------------------------------------------------------------+