test: fix 2 testcases for API tzset

1.modifications:
testsuites/unittest/time/timer/smoke/timer_test_tzset_001.cpp
testsuites/unittest/time/timer/smoke/timer_test_tzset_002.cpp
testsuites/unittest/time/timer/time_timer_test.cpp

2.influence:
none

Signed-off-by: teamol <28105285@qq.com>
This commit is contained in:
teamol 2021-06-18 17:25:04 +08:00
parent f8cf6e6439
commit e4b6ba56b9
3 changed files with 25 additions and 13 deletions

View File

@ -36,7 +36,7 @@
#include "lt_timer_test.h" #include "lt_timer_test.h"
#include <stdlib.h> #include <stdlib.h>
static UINT32 testcase1(VOID) static UINT32 testcase(VOID)
{ {
time_t td; time_t td;
int ret = 0; int ret = 0;
@ -58,11 +58,6 @@ OUT:
return LOS_NOK; return LOS_NOK;
} }
static UINT32 testcase(VOID)
{
testcase1();
}
void TIME_TEST_TZSET_001(void) void TIME_TEST_TZSET_001(void)
{ {
TEST_ADD_CASE(__FUNCTION__, testcase, TEST_POSIX, TEST_SWTMR, TEST_LEVEL0, TEST_FUNCTION); TEST_ADD_CASE(__FUNCTION__, testcase, TEST_POSIX, TEST_SWTMR, TEST_LEVEL0, TEST_FUNCTION);

View File

@ -36,13 +36,13 @@
#include "lt_timer_test.h" #include "lt_timer_test.h"
#include <stdlib.h> #include <stdlib.h>
static UINT32 testcase1(VOID) static UINT32 testcase(VOID)
{ {
time_t td; time_t td;
int ret = 0; int ret = 0;
errno = 0; errno = 0;
ret = putenv("TZ=GMT-100"); ret = putenv((char *) "TZ=GMT-100");
ICUNIT_ASSERT_EQUAL(ret, 0, ret); ICUNIT_ASSERT_EQUAL(ret, 0, ret);
tzset(); tzset();
@ -58,11 +58,6 @@ OUT:
return LOS_NOK; return LOS_NOK;
} }
static UINT32 testcase(VOID)
{
testcase1();
}
void TIME_TEST_TZSET_002(void) void TIME_TEST_TZSET_002(void)
{ {
TEST_ADD_CASE(__FUNCTION__, testcase, TEST_POSIX, TEST_SWTMR, TEST_LEVEL0, TEST_FUNCTION); TEST_ADD_CASE(__FUNCTION__, testcase, TEST_POSIX, TEST_SWTMR, TEST_LEVEL0, TEST_FUNCTION);

View File

@ -97,5 +97,27 @@ HWTEST_F(TimeTimerTest, TimerTest005, TestSize.Level0)
{ {
TimerTest005(); TimerTest005();
} }
/* *
* @tc.name: TIME_TEST_TZSET_001
* @tc.desc: function for TIME_TEST_TZSET_001
* @tc.type: FUNC
* @tc.require: AR000EEMQ9
*/
HWTEST_F(TimeTimerTest, TIME_TEST_TZSET_001, TestSize.Level0)
{
TIME_TEST_TZSET_001();
}
/* *
* @tc.name: TIME_TEST_TZSET_002
* @tc.desc: function for TimeTimerTest
* @tc.type: FUNC
* @tc.require: AR000EEMQ9
*/
HWTEST_F(TimeTimerTest, TIME_TEST_TZSET_002, TestSize.Level0)
{
TIME_TEST_TZSET_002();
}
#endif #endif
} // namespace OHOS } // namespace OHOS