Skip to content

Commit bb32361

Browse files
committed
add documentation
1 parent 4ae64f1 commit bb32361

File tree

4 files changed

+30
-3
lines changed

4 files changed

+30
-3
lines changed

TESTS/mbed_drivers/watchdog_reset/Watchdog_reset_tests.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,16 @@ void test_restart_reset();
6464
*/
6565
void test_kick_reset();
6666

67+
/** Test Watchdog timeout
68+
*
69+
* Given a device with a Watchdog started,
70+
* when the Watchdog timout doesn't expire,
71+
* then the device restart is not performed.
72+
* When the Watchdog timout do expires,
73+
* then the device is restarted after the timeout and before twice the timeout value.
74+
*/
75+
void test_timeout();
76+
6777
#endif
6878

6979
#endif

TESTS/mbed_drivers/watchdog_reset/main.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,8 +297,11 @@ void test_timeout()
297297
}
298298

299299
// Phase 1. -- run the test code.
300-
// Kick watchdog before timeout.
301300
TEST_ASSERT_TRUE(watchdog.start(TIMEOUT_LOWER_LIMIT));
301+
302+
// Kick watchdog before timeout.
303+
// Watchdog should not trigger before timeout.
304+
// If device restarts while waiting for the kick, test fails.
302305
wait_ms(TIMEOUT_LOWER_LIMIT - window);
303306
watchdog.kick();
304307

@@ -308,6 +311,7 @@ void test_timeout()
308311
}
309312
watchdog.kick();
310313

314+
// Watchdog should fire before twice the timeout value.
311315
wait_ms(2 * TIMEOUT_LOWER_LIMIT);
312316

313317
// Watchdog reset should have occurred during that wait() above;

TESTS/mbed_hal/watchdog_reset/main.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -283,10 +283,12 @@ void test_timeout()
283283
}
284284

285285
// Phase 1. -- run the test code.
286-
// Kick watchdog before timeout.
287286
watchdog_config_t config = { TIMEOUT_LOWER_LIMIT };
288-
289287
TEST_ASSERT_EQUAL(WATCHDOG_STATUS_OK, hal_watchdog_init(&config));
288+
289+
// Kick watchdog before timeout.
290+
// Watchdog should not trigger before timeout.
291+
// If device restarts while waiting for the kick, test fails.
290292
wait_ms(TIMEOUT_LOWER_LIMIT - window);
291293
hal_watchdog_kick();
292294

@@ -296,6 +298,7 @@ void test_timeout()
296298
}
297299
hal_watchdog_kick();
298300

301+
// Watchdog should fire before twice the timeout value.
299302
wait_ms(2 * TIMEOUT_LOWER_LIMIT);
300303

301304
// Watchdog reset should have occurred during that wait() above;

TESTS/mbed_hal/watchdog_reset/watchdog_reset_tests.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,16 @@ void test_restart_reset();
6969
*/
7070
void test_kick_reset();
7171

72+
/** Test Watchdog timeout
73+
*
74+
* Given a device with a Watchdog started,
75+
* when the Watchdog timout doesn't expire,
76+
* then the device restart is not performed.
77+
* When the Watchdog timout do expires,
78+
* then the device is restarted after the timeout and before twice the timeout value.
79+
*/
80+
void test_timeout();
81+
7282
#endif
7383

7484
#endif

0 commit comments

Comments
 (0)