diff options
| author | hathach <[email protected]> | 2013-04-27 00:24:15 +0700 |
|---|---|---|
| committer | hathach <[email protected]> | 2013-04-27 00:24:15 +0700 |
| commit | 8bd077fa5c21ade1aa791b0339b66e637ad894e5 (patch) | |
| tree | d2b334ebcd6b36b4a31d7318c7c1092a3af82121 /tests | |
| parent | 33feba5cbc7a344f1bac67508e5658aa615e59bf (diff) | |
fix bug (wrong logic) with osal_task_delay in non OS configure
complete keyboard app with key state & event TODO handle & check for non-printable(control) keycode
add unit test for osal_task_delay for non OS
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/test/host/hid/test_hidh_keyboard.c | 4 | ||||
| -rw-r--r-- | tests/test/test_osal_none.c | 30 |
2 files changed, 31 insertions, 3 deletions
diff --git a/tests/test/host/hid/test_hidh_keyboard.c b/tests/test/host/hid/test_hidh_keyboard.c index fa15f221b..b1fc6e381 100644 --- a/tests/test/host/hid/test_hidh_keyboard.c +++ b/tests/test/host/hid/test_hidh_keyboard.c @@ -53,11 +53,11 @@ tusb_keyboard_report_t sample_key[2] = { { .modifier = KEYBOARD_MODIFIER_LEFTCTRL, - .keycode = {KEYBOARD_KEYCODE_a} + .keycode = {4}//{KEYBOARD_KEYCODE_a} TODO ascii to key code table }, { .modifier = KEYBOARD_MODIFIER_RIGHTALT, - .keycode = {KEYBOARD_KEYCODE_z} + .keycode = {5}//{KEYBOARD_KEYCODE_z} } }; diff --git a/tests/test/test_osal_none.c b/tests/test/test_osal_none.c index 32f3d2409..e75f2e514 100644 --- a/tests/test/test_osal_none.c +++ b/tests/test/test_osal_none.c @@ -163,7 +163,7 @@ void test_task_with_semaphore(void) } //--------------------------------------------------------------------+ -// TASK SEMAPHORE +// TASK QUEUE //--------------------------------------------------------------------+ tusb_error_t sample_task_with_queue(void) { @@ -234,6 +234,34 @@ void test_task_with_queue(void) } //--------------------------------------------------------------------+ +// TASK DELAY +//--------------------------------------------------------------------+ +tusb_error_t sample_task_with_delay(void) +{ + tusb_error_t error; + + OSAL_TASK_LOOP_BEGIN + + osal_task_delay(1000); + + statements[0]++; + + OSAL_TASK_LOOP_END +} + +void test_task_with_delay(void) +{ + sample_task_with_delay(); + TEST_ASSERT_EQUAL(0, statements[0]); + + for(uint32_t i=0; i<TUSB_CFG_OS_TICKS_PER_SECOND*1000; i++) // not enough time + osal_tick_tock(); + + sample_task_with_delay(); + TEST_ASSERT_EQUAL(1, statements[0]); +} + +//--------------------------------------------------------------------+ // TASK FLOW CONTROL //--------------------------------------------------------------------+ void flow_control_error_handler(void) |
