13 #include <gtest/gtest.h>
22 using std::chrono::milliseconds;
34 :
root(
"root_sequence")
35 ,
action_1(
"action_1", milliseconds(100))
55 condition_1.setExpectedResult(NodeStatus::FAILURE);
56 condition_2.setExpectedResult(NodeStatus::SUCCESS);
60 ASSERT_EQ(NodeStatus::RUNNING, state);
61 ASSERT_EQ(NodeStatus::SUCCESS, fal_conditions.status());
62 ASSERT_EQ(NodeStatus::IDLE, condition_1.status());
63 ASSERT_EQ(NodeStatus::IDLE, condition_2.status());
64 ASSERT_EQ(NodeStatus::RUNNING, action_1.status());
69 condition_2.setExpectedResult(NodeStatus::FAILURE);
70 condition_1.setExpectedResult(NodeStatus::SUCCESS);
74 ASSERT_EQ(NodeStatus::RUNNING, state);
75 ASSERT_EQ(NodeStatus::SUCCESS, fal_conditions.status());
76 ASSERT_EQ(NodeStatus::IDLE, condition_1.status());
77 ASSERT_EQ(NodeStatus::IDLE, condition_2.status());
78 ASSERT_EQ(NodeStatus::RUNNING, action_1.status());
87 std::stringstream stream;
89 const auto string = stream.str();
93 ASSERT_FALSE(std::getline(stream, line,
'\n').fail());
94 ASSERT_STREQ(
"----------------", line.c_str());
97 ASSERT_FALSE(std::getline(stream, line,
'\n').fail());
98 ASSERT_STREQ(root.name().c_str(), line.c_str());
100 ASSERT_FALSE(std::getline(stream, line,
'\n').fail());
101 ASSERT_STREQ((
" " + fal_conditions.name()).c_str(), line.c_str());
103 ASSERT_FALSE(std::getline(stream, line,
'\n').fail());
104 ASSERT_STREQ((
" " + condition_1.name()).c_str(), line.c_str());
106 ASSERT_FALSE(std::getline(stream, line,
'\n').fail());
107 ASSERT_STREQ((
" " + condition_2.name()).c_str(), line.c_str());
109 ASSERT_FALSE(std::getline(stream, line,
'\n').fail());
110 ASSERT_STREQ((
" " + action_1.name()).c_str(), line.c_str());
113 ASSERT_FALSE(std::getline(stream, line,
'\n').fail());
114 ASSERT_STREQ(
"----------------", line.c_str());
117 ASSERT_TRUE(std::getline(stream, line,
'\n').fail());
120 int main(
int argc,
char** argv)
122 testing::InitGoogleTest(&argc, argv);
123 return RUN_ALL_TESTS();