| 328 | } |
| 329 | |
| 330 | NodeStatus BehaviorState::runParallel(ParallelNode const& node, NodeState& state) { |
| 331 | if (state.isNothing()) |
| 332 | state.set(CompositeState(node.children.size())); |
| 333 | |
| 334 | CompositeState& composite = state->get<CompositeState>(); |
| 335 | |
| 336 | int failed = 0; |
| 337 | int succeeded = 0; |
| 338 | for (size_t i = 0; i < node.children.size(); i++) { |
| 339 | NodeStatus status = runNode(*node.children[i], *composite.children[i]); |
| 340 | if (status == NodeStatus::Success) |
| 341 | succeeded++; |
| 342 | else if (status == NodeStatus::Failure) |
| 343 | failed++; |
| 344 | |
| 345 | if (succeeded >= node.succeed || failed >= node.fail) { |
| 346 | return succeeded >= node.succeed ? NodeStatus::Success : NodeStatus::Failure; |
| 347 | } |
| 348 | } |
| 349 | |
| 350 | return NodeStatus::Running; |
| 351 | } |
| 352 | |
| 353 | NodeStatus BehaviorState::runDynamic(DynamicNode const& node, NodeState& state) { |
| 354 | if (state.isNothing()) |
nothing calls this directly
no test coverage detected