summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChen Wang <[email protected]>2025-05-30 08:17:06 +0800
committerRbb666 <[email protected]>2025-05-30 09:33:00 +0800
commit890a4bad7289d3e42a417de6077e1a4788e82c8a (patch)
tree30cccdf7134b17d9536d2b34954309aee2f5ba66
parentf4e619a17c17cd093c2cc37e04e0159e0ac79388 (diff)
bsp: k230: use utest asset api
Use utest assert API for utest cases. Signed-off-by: Chen Wang <[email protected]>
-rw-r--r--bsp/k230/drivers/utest/test_wdt.c36
1 files changed, 6 insertions, 30 deletions
diff --git a/bsp/k230/drivers/utest/test_wdt.c b/bsp/k230/drivers/utest/test_wdt.c
index 6736ca7f34..61837cbab6 100644
--- a/bsp/k230/drivers/utest/test_wdt.c
+++ b/bsp/k230/drivers/utest/test_wdt.c
@@ -71,27 +71,15 @@ static void test_wdt_feed(void)
/* Find the watchdog device according to the name and obtain the handle */
wdg_dev = rt_device_find(IWDG_DEVICE_NAME);
- if (!wdg_dev)
- {
- LOG_E("find %s failed!\n", IWDG_DEVICE_NAME);
- return;
- }
+ uassert_not_null(wdg_dev);
/* Initialize the device */
ret = rt_device_init(wdg_dev);
- if (ret != RT_EOK)
- {
- LOG_E("initialize %s failed!\n", IWDG_DEVICE_NAME);
- return;
- }
+ uassert_int_equal(ret, RT_EOK);
/* Set the watchdog timeout time */
ret = rt_device_control(wdg_dev, KD_DEVICE_CTRL_WDT_SET_TIMEOUT, &timeout);
- if (ret != RT_EOK)
- {
- LOG_E("set %s timeout failed!\n", IWDG_DEVICE_NAME);
- return;
- }
+ uassert_int_equal(ret, RT_EOK);
flag_feed = 1; /* Set feed the dog sign */
@@ -118,27 +106,15 @@ static void test_wdt_nofeed(void)
/* Find the watchdog device according to the name and obtain the handle */
wdg_dev = rt_device_find(IWDG_DEVICE_NAME);
- if (!wdg_dev)
- {
- LOG_E("find %s failed!\n", IWDG_DEVICE_NAME);
- return;
- }
+ uassert_not_null(wdg_dev);
/* Initialize the device */
ret = rt_device_init(wdg_dev);
- if (ret != RT_EOK)
- {
- LOG_E("initialize %s failed!\n", IWDG_DEVICE_NAME);
- return;
- }
+ uassert_int_equal(ret, RT_EOK);
/* Set the watchdog timeout time */
ret = rt_device_control(wdg_dev, KD_DEVICE_CTRL_WDT_SET_TIMEOUT, &timeout);
- if (ret != RT_EOK)
- {
- LOG_E("set %s timeout failed!\n", IWDG_DEVICE_NAME);
- return;
- }
+ uassert_int_equal(ret, RT_EOK);
flag_feed = 0; /* Do not feed the dog */