blob: 243380d330cf89a31149678378085f677ff0269d [file] [log] [blame]
Patrick Ventured53d60a2020-04-07 09:01:34 -07001#include "skip_action.hpp"
2#include "status.hpp"
3
4#include <gmock/gmock.h>
5#include <gtest/gtest.h>
6
7namespace ipmi_flash
8{
9namespace
10{
11
12TEST(SkipActionTest, ValidateTriggerReturnsTrue)
13{
14 SkipAction skip;
15 EXPECT_TRUE(skip.trigger());
William A. Kennington III4175b4c2020-12-23 22:45:18 -080016 size_t i = 0;
17 skip.setCallback([&](TriggerableActionInterface&) { i++; });
Patrick Ventured53d60a2020-04-07 09:01:34 -070018 EXPECT_TRUE(skip.trigger());
William A. Kennington III4175b4c2020-12-23 22:45:18 -080019 EXPECT_EQ(1, i);
20 EXPECT_TRUE(skip.trigger());
21 EXPECT_EQ(2, i);
Patrick Ventured53d60a2020-04-07 09:01:34 -070022}
23
24TEST(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
32TEST(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