tests: unit: move the timeutil test to new ztest API

Migrate the testsuite tests/unit/timeutil to the new ztest API.

Signed-off-by: Enjia Mai <enjia.mai@intel.com>
This commit is contained in:
Enjia Mai 2022-08-21 16:36:13 +08:00 committed by Carles Cufí
commit 7133f34c1b
6 changed files with 6 additions and 15 deletions

View file

@ -52,14 +52,4 @@ void timeutil_check(const struct timeutil_test_data *tp,
}
}
/*test case main entry*/
void test_main(void)
{
ztest_test_suite(test_timeutil_api,
ztest_unit_test(test_gmtime),
ztest_unit_test(test_s32),
ztest_unit_test(test_s64),
ztest_unit_test(test_sync)
);
ztest_run_test_suite(test_timeutil_api);
}
ZTEST_SUITE(timeutil_api, NULL, NULL, NULL, NULL, NULL);

View file

@ -0,0 +1 @@
CONFIG_ZTEST_NEW_API=y

View file

@ -10,7 +10,7 @@
#include <zephyr/ztest.h>
#include "timeutil_test.h"
void test_gmtime(void)
ZTEST(timeutil_api, test_gmtime)
{
struct tm tm = {
/* Initialize an unset field */

View file

@ -238,7 +238,7 @@ static const struct timeutil_test_data tests[] = {
} },
};
void test_s32(void)
ZTEST(timeutil_api, test_s32)
{
timeutil_check(tests, sizeof(tests) / sizeof(*tests));
}

View file

@ -323,7 +323,7 @@ static void test_time32_overflow(void)
"final errno state bad");
}
void test_s64(void)
ZTEST(timeutil_api, test_s64)
{
if (sizeof(time_t) < 8U) {
test_time32_errno_clear();

View file

@ -426,7 +426,7 @@ static void test_skew_to_ppb(void)
"unexpected above limit: %.10g %d", skew, ppb);
}
void test_sync(void)
ZTEST(timeutil_api, test_sync)
{
test_state_update();
test_state_set_skew();