Patrick Venture | d53d60a | 2020-04-07 09:01:34 -0700 | [diff] [blame] | 1 | #include "skip_action.hpp" |
| 2 | #include "status.hpp" |
| 3 | |
| 4 | #include <gmock/gmock.h> |
| 5 | #include <gtest/gtest.h> |
| 6 | |
| 7 | namespace ipmi_flash |
| 8 | { |
| 9 | namespace |
| 10 | { |
| 11 | |
| 12 | TEST(SkipActionTest, ValidateTriggerReturnsTrue) |
| 13 | { |
| 14 | SkipAction skip; |
| 15 | EXPECT_TRUE(skip.trigger()); |
William A. Kennington III | 4175b4c | 2020-12-23 22:45:18 -0800 | [diff] [blame] | 16 | size_t i = 0; |
| 17 | skip.setCallback([&](TriggerableActionInterface&) { i++; }); |
Patrick Venture | d53d60a | 2020-04-07 09:01:34 -0700 | [diff] [blame] | 18 | EXPECT_TRUE(skip.trigger()); |
William A. Kennington III | 4175b4c | 2020-12-23 22:45:18 -0800 | [diff] [blame] | 19 | EXPECT_EQ(1, i); |
| 20 | EXPECT_TRUE(skip.trigger()); |
| 21 | EXPECT_EQ(2, i); |
Patrick Venture | d53d60a | 2020-04-07 09:01:34 -0700 | [diff] [blame] | 22 | } |
| 23 | |
| 24 | TEST(SkipActionTest, ValidateStatusAlwaysSuccess) |
| 25 | { |
| 26 | SkipAction skip; |
| 27 | EXPECT_EQ(ActionStatus::success, skip.status()); |
| 28 | EXPECT_TRUE(skip.trigger()); |
| 29 | EXPECT_EQ(ActionStatus::success, skip.status()); |
| 30 | } |
| 31 | |
| 32 | TEST(SkipActionTest, AbortHasNoImpactOnStatus) |
| 33 | { |
| 34 | SkipAction skip; |
| 35 | EXPECT_EQ(ActionStatus::success, skip.status()); |
| 36 | skip.abort(); |
| 37 | EXPECT_EQ(ActionStatus::success, skip.status()); |
| 38 | } |
| 39 | |
| 40 | } // namespace |
| 41 | } // namespace ipmi_flash |