@@ -71,27 +71,15 @@ static void test_wdt_feed(void)
7171
7272    /* Find the watchdog device according to the name and obtain the handle */ 
7373    wdg_dev  =  rt_device_find (IWDG_DEVICE_NAME );
74-     if  (!wdg_dev )
75-     {
76-         LOG_E ("find %s failed!\n" , IWDG_DEVICE_NAME );
77-         return ;
78-     }
74+     uassert_not_null (wdg_dev );
7975
8076    /* Initialize the device */ 
8177    ret  =  rt_device_init (wdg_dev );
82-     if  (ret  !=  RT_EOK )
83-     {
84-         LOG_E ("initialize %s failed!\n" , IWDG_DEVICE_NAME );
85-         return ;
86-     }
78+     uassert_int_equal (ret , RT_EOK );
8779
8880    /* Set the watchdog timeout time */ 
8981    ret  =  rt_device_control (wdg_dev , KD_DEVICE_CTRL_WDT_SET_TIMEOUT , & timeout );
90-     if  (ret  !=  RT_EOK )
91-     {
92-         LOG_E ("set %s timeout failed!\n" , IWDG_DEVICE_NAME );
93-         return ;
94-     }
82+     uassert_int_equal (ret , RT_EOK );
9583
9684    flag_feed  =  1 ; /* Set feed the dog sign */ 
9785
@@ -118,27 +106,15 @@ static void test_wdt_nofeed(void)
118106
119107    /* Find the watchdog device according to the name and obtain the handle */ 
120108    wdg_dev  =  rt_device_find (IWDG_DEVICE_NAME );
121-     if  (!wdg_dev )
122-     {
123-         LOG_E ("find %s failed!\n" , IWDG_DEVICE_NAME );
124-         return ;
125-     }
109+     uassert_not_null (wdg_dev );
126110
127111    /* Initialize the device */ 
128112    ret  =  rt_device_init (wdg_dev );
129-     if  (ret  !=  RT_EOK )
130-     {
131-         LOG_E ("initialize %s failed!\n" , IWDG_DEVICE_NAME );
132-         return ;
133-     }
113+     uassert_int_equal (ret , RT_EOK );
134114
135115    /* Set the watchdog timeout time */ 
136116    ret  =  rt_device_control (wdg_dev , KD_DEVICE_CTRL_WDT_SET_TIMEOUT , & timeout );
137-     if  (ret  !=  RT_EOK )
138-     {
139-         LOG_E ("set %s timeout failed!\n" , IWDG_DEVICE_NAME );
140-         return ;
141-     }
117+     uassert_int_equal (ret , RT_EOK );
142118
143119    flag_feed  =  0 ; /* Do not feed the dog */ 
144120
0 commit comments