From a502a0917c1c939303eaa7fd1c51bd19818d83cb Mon Sep 17 00:00:00 2001 From: wenxin-liu_admin Date: Wed, 28 Sep 2022 17:20:55 +0800 Subject: [PATCH] =?UTF-8?q?:cmsis=20=E6=B5=8B=E8=AF=95=E7=94=A8=E4=BE=8B?= =?UTF-8?q?=E8=A1=A5=E5=85=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: wenxin-liu_admin Change-Id: Iaa133871c465e20170a3bf2204cb1c6ba40fda72 --- testsuites/sample/cmsis/cmsis_func_test.c | 49 +++++++++++++++++++++++ 1 file changed, 49 insertions(+) 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); }