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 
TEST(SkipActionTest,ValidateTriggerReturnsTrue)12 TEST(SkipActionTest, ValidateTriggerReturnsTrue)
13 {
14     SkipAction skip;
15     EXPECT_TRUE(skip.trigger());
16     size_t i = 0;
17     skip.setCallback([&](TriggerableActionInterface&) { i++; });
18     EXPECT_TRUE(skip.trigger());
19     EXPECT_EQ(1, i);
20     EXPECT_TRUE(skip.trigger());
21     EXPECT_EQ(2, i);
22 }
23 
TEST(SkipActionTest,ValidateStatusAlwaysSuccess)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 
TEST(SkipActionTest,AbortHasNoImpactOnStatus)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
42