Skip to content

Commit 2611bba

Browse files
committed
add documentation
1 parent 7756d6d commit 2611bba

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
@@ -282,8 +282,11 @@ void test_timeout()
282282
}
283283

284284
// Phase 1. -- run the test code.
285-
// Kick watchdog before timeout.
286285
TEST_ASSERT_TRUE(watchdog.start(TIMEOUT_LOWER_LIMIT));
286+
287+
// Kick watchdog before timeout.
288+
// Watchdog should not trigger before timeout.
289+
// If device restarts while waiting for the kick, test fails.
287290
wait_ms(TIMEOUT_LOWER_LIMIT - window);
288291
watchdog.kick();
289292

@@ -293,6 +296,7 @@ void test_timeout()
293296
}
294297
watchdog.kick();
295298

299+
// Watchdog should fire before twice the timeout value.
296300
wait_ms(2 * TIMEOUT_LOWER_LIMIT);
297301

298302
// 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
@@ -268,10 +268,12 @@ void test_timeout()
268268
}
269269

270270
// Phase 1. -- run the test code.
271-
// Kick watchdog before timeout.
272271
watchdog_config_t config = { TIMEOUT_LOWER_LIMIT };
273-
274272
TEST_ASSERT_EQUAL(WATCHDOG_STATUS_OK, hal_watchdog_init(&config));
273+
274+
// Kick watchdog before timeout.
275+
// Watchdog should not trigger before timeout.
276+
// If device restarts while waiting for the kick, test fails.
275277
wait_ms(TIMEOUT_LOWER_LIMIT - window);
276278
hal_watchdog_kick();
277279

@@ -281,6 +283,7 @@ void test_timeout()
281283
}
282284
hal_watchdog_kick();
283285

286+
// Watchdog should fire before twice the timeout value.
284287
wait_ms(2 * TIMEOUT_LOWER_LIMIT);
285288

286289
// 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)