| 31 | }; |
| 32 | |
| 33 | TEST_F(WhileDoElseTest, ConditionTrue_DoBranch) |
| 34 | { |
| 35 | // When condition is true, execute the "do" branch |
| 36 | const std::string xml_text = R"( |
| 37 | <root BTCPP_format="4"> |
| 38 | <BehaviorTree> |
| 39 | <WhileDoElse> |
| 40 | <AlwaysSuccess/> <!-- condition --> |
| 41 | <TestA/> <!-- do --> |
| 42 | <TestB/> <!-- else --> |
| 43 | </WhileDoElse> |
| 44 | </BehaviorTree> |
| 45 | </root>)"; |
| 46 | |
| 47 | auto tree = factory.createTreeFromText(xml_text); |
| 48 | auto status = tree.tickWhileRunning(); |
| 49 | |
| 50 | ASSERT_EQ(status, NodeStatus::SUCCESS); |
| 51 | ASSERT_EQ(counters[0], 1); // TestA executed |
| 52 | ASSERT_EQ(counters[1], 0); // TestB not executed |
| 53 | } |
| 54 | |
| 55 | TEST_F(WhileDoElseTest, ConditionFalse_ElseBranch) |
| 56 | { |
nothing calls this directly
no test coverage detected