diff --git a/testsuites/sample/cmsis/cmsis_func_test.c b/testsuites/sample/cmsis/cmsis_func_test.c index aa15c496..a3b6709a 100644 --- a/testsuites/sample/cmsis/cmsis_func_test.c +++ b/testsuites/sample/cmsis/cmsis_func_test.c @@ -449,6 +449,53 @@ LITE_TEST_CASE(CmsisFuncTestSuite, TestCmsis002, Function | MediumTest | Level1) return LOS_OK; }; +static VOID timerCallback(void *arg) +{ + return; +} + +/** + * @tc.name: TestCmsisTimer001 + * @tc.desc: Timer Management test + * @tc.type: FUNC + * @tc.require: issueI5TQ0T + */ +LITE_TEST_CASE(CmsisFuncTestSuite, TestCmsisTimer001, Function | MediumTest | Level1) +{ + osTimerId_t time_id; + const char *timerGetName = NULL; + osStatus_t ret; + + time_id = osTimerNew(timerCallback, osTimerOnce, NULL, NULL); + ICUNIT_ASSERT_NOT_EQUAL(time_id, NULL, time_id); + + ret = osTimerStart(time_id, 100U); // 100, just for test + ICUNIT_ASSERT_EQUAL(ret, osOK, ret); + + timerGetName = osTimerGetName(time_id); + ICUNIT_GOTO_EQUAL(timerGetName, NULL, timerGetName, EXIT1); + + ret = osTimerIsRunning(time_id); + ICUNIT_GOTO_EQUAL(ret, 1, ret, EXIT1); + + ret = osTimerStop(time_id); + ICUNIT_GOTO_EQUAL(ret, osOK, ret, EXIT1); + + ret = osTimerIsRunning(time_id); + ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); + + ret = osTimerDelete(time_id); + ICUNIT_ASSERT_EQUAL(ret, osOK, ret); + + return LOS_OK; + +EXIT1: + ret = osTimerDelete(time_id); + ICUNIT_ASSERT_EQUAL(ret, osOK, ret); + + return LOS_OK; +}; + void CmsisFuncTestSuite(void) { @@ -465,5 +512,7 @@ void CmsisFuncTestSuite(void) #endif ADD_TEST_CASE(TestCmsis007); + + ADD_TEST_CASE(TestCmsisTimer001); }