@@ -52,11 +52,11 @@ TEST_F(SwitchTest, DefaultCase)
52
52
ASSERT_EQ (NodeStatus::RUNNING, state);
53
53
54
54
std::this_thread::sleep_for (milliseconds (110 ));
55
+ state = root->executeTick ();
55
56
56
- // Switch Node does not halt action after success ?
57
57
ASSERT_EQ (NodeStatus::IDLE, action_1.status ());
58
58
ASSERT_EQ (NodeStatus::IDLE, action_2.status ());
59
- ASSERT_EQ (NodeStatus::SUCCESS , action_3.status ());
59
+ ASSERT_EQ (NodeStatus::IDLE , action_3.status ());
60
60
ASSERT_EQ (NodeStatus::SUCCESS, state);
61
61
}
62
62
@@ -71,8 +71,9 @@ TEST_F(SwitchTest, Case1)
71
71
ASSERT_EQ (NodeStatus::RUNNING, state);
72
72
73
73
std::this_thread::sleep_for (milliseconds (110 ));
74
+ state = root->executeTick ();
74
75
75
- ASSERT_EQ (NodeStatus::SUCCESS , action_1.status ());
76
+ ASSERT_EQ (NodeStatus::IDLE , action_1.status ());
76
77
ASSERT_EQ (NodeStatus::IDLE, action_2.status ());
77
78
ASSERT_EQ (NodeStatus::IDLE, action_3.status ());
78
79
ASSERT_EQ (NodeStatus::SUCCESS, state);
@@ -89,9 +90,10 @@ TEST_F(SwitchTest, Case2)
89
90
ASSERT_EQ (NodeStatus::RUNNING, state);
90
91
91
92
std::this_thread::sleep_for (milliseconds (110 ));
93
+ state = root->executeTick ();
92
94
93
95
ASSERT_EQ (NodeStatus::IDLE, action_1.status ());
94
- ASSERT_EQ (NodeStatus::SUCCESS , action_2.status ());
96
+ ASSERT_EQ (NodeStatus::IDLE , action_2.status ());
95
97
ASSERT_EQ (NodeStatus::IDLE, action_3.status ());
96
98
ASSERT_EQ (NodeStatus::SUCCESS, state);
97
99
}
@@ -107,10 +109,11 @@ TEST_F(SwitchTest, CaseNone)
107
109
ASSERT_EQ (NodeStatus::RUNNING, state);
108
110
109
111
std::this_thread::sleep_for (milliseconds (110 ));
112
+ state = root->executeTick ();
110
113
111
114
ASSERT_EQ (NodeStatus::IDLE, action_1.status ());
112
115
ASSERT_EQ (NodeStatus::IDLE, action_2.status ());
113
- ASSERT_EQ (NodeStatus::SUCCESS , action_3.status ());
116
+ ASSERT_EQ (NodeStatus::IDLE , action_3.status ());
114
117
ASSERT_EQ (NodeStatus::SUCCESS, state);
115
118
}
116
119
@@ -131,8 +134,8 @@ TEST_F(SwitchTest, CaseSwitchToDefault)
131
134
ASSERT_EQ (NodeStatus::IDLE, action_3.status ());
132
135
ASSERT_EQ (NodeStatus::RUNNING, state);
133
136
134
- // Switch Node feels changes only when tick ? (no while loop inside,
135
- // not reactive)
137
+ // Switch Node does not feels changes. Only when tick.
138
+ // ( not reactive)
136
139
std::this_thread::sleep_for (milliseconds (10 ));
137
140
bb->set (" variable" , " " );
138
141
std::this_thread::sleep_for (milliseconds (10 ));
@@ -149,10 +152,11 @@ TEST_F(SwitchTest, CaseSwitchToDefault)
149
152
ASSERT_EQ (NodeStatus::RUNNING, state);
150
153
151
154
std::this_thread::sleep_for (milliseconds (110 ));
155
+ state = root->executeTick ();
152
156
153
157
ASSERT_EQ (NodeStatus::IDLE, action_1.status ());
154
158
ASSERT_EQ (NodeStatus::IDLE, action_2.status ());
155
- ASSERT_EQ (NodeStatus::SUCCESS , action_3.status ());
159
+ ASSERT_EQ (NodeStatus::IDLE , action_3.status ());
156
160
ASSERT_EQ (NodeStatus::SUCCESS, root->status ());
157
161
}
158
162
@@ -175,9 +179,10 @@ TEST_F(SwitchTest, CaseSwitchToAction2)
175
179
ASSERT_EQ (NodeStatus::RUNNING, state);
176
180
177
181
std::this_thread::sleep_for (milliseconds (110 ));
182
+ state = root->executeTick ();
178
183
179
184
ASSERT_EQ (NodeStatus::IDLE, action_1.status ());
180
- ASSERT_EQ (NodeStatus::SUCCESS , action_2.status ());
185
+ ASSERT_EQ (NodeStatus::IDLE , action_2.status ());
181
186
ASSERT_EQ (NodeStatus::IDLE, action_3.status ());
182
187
ASSERT_EQ (NodeStatus::SUCCESS, root->status ());
183
188
}
@@ -192,19 +197,18 @@ TEST_F(SwitchTest, ActionFailure)
192
197
ASSERT_EQ (NodeStatus::IDLE, action_3.status ());
193
198
ASSERT_EQ (NodeStatus::RUNNING, state);
194
199
195
- // Switch Node does not halt after failure ?
196
200
std::this_thread::sleep_for (milliseconds (10 ));
197
201
action_1.setStatus (NodeStatus::FAILURE);
198
202
state = root->executeTick ();
199
203
ASSERT_EQ (NodeStatus::FAILURE, action_1.status ());
200
204
ASSERT_EQ (NodeStatus::IDLE, action_2.status ());
201
205
ASSERT_EQ (NodeStatus::IDLE, action_3.status ());
202
- ASSERT_EQ (NodeStatus::FAILURE , state);
206
+ ASSERT_EQ (NodeStatus::IDLE , state);
203
207
204
208
state = root->executeTick ();
205
209
state = root->executeTick ();
206
210
ASSERT_EQ (NodeStatus::FAILURE, action_1.status ());
207
211
ASSERT_EQ (NodeStatus::IDLE, action_2.status ());
208
212
ASSERT_EQ (NodeStatus::IDLE, action_3.status ());
209
- ASSERT_EQ (NodeStatus::FAILURE , state);
213
+ ASSERT_EQ (NodeStatus::IDLE , state);
210
214
}
0 commit comments