From 25c1b20f973e2c3d71cf078b36b87769a248de6e Mon Sep 17 00:00:00 2001 From: "William A. Kennington III" Date: Thu, 1 Mar 2018 11:00:19 -0800 Subject: tests/watchdog: Make sure the watchdog can be configured while disabled Change-Id: If25a533fd23ede502df402d021742aa19f64d2f6 Signed-off-by: William A. Kennington III --- test/watchdog_test.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/test/watchdog_test.cpp b/test/watchdog_test.cpp index 72347aa..8a62cf2 100644 --- a/test/watchdog_test.cpp +++ b/test/watchdog_test.cpp @@ -32,6 +32,26 @@ TEST_F(WdogTest, createWdogAndDontEnable) EXPECT_EQ(0, wdog->timeRemaining()); EXPECT_FALSE(wdog->timerExpired()); EXPECT_FALSE(wdog->timerEnabled()); + + // We should be able to configure persistent properties + // while disabled + auto newAction = Watchdog::Action::PowerOff; + EXPECT_EQ(newAction, wdog->expireAction(newAction)); + auto newIntervalMs = milliseconds(defaultInterval * 2).count(); + EXPECT_EQ(newIntervalMs, wdog->interval(newIntervalMs)); + + EXPECT_EQ(newAction, wdog->expireAction()); + EXPECT_EQ(newIntervalMs, wdog->interval()); + + // We won't be able to configure timeRemaining + EXPECT_EQ(0, wdog->timeRemaining(1000)); + EXPECT_EQ(0, wdog->timeRemaining()); + + // Timer should not have become enabled + EXPECT_FALSE(wdog->enabled()); + EXPECT_EQ(0, wdog->timeRemaining()); + EXPECT_FALSE(wdog->timerExpired()); + EXPECT_FALSE(wdog->timerEnabled()); } /** @brief Make sure that watchdog is started and enabled */ -- cgit v1.2.1