| 31 | }; |
| 32 | |
| 33 | TEST_F(TryCatchTest, AllTryChildrenSucceed) |
| 34 | { |
| 35 | const std::string xml_text = R"( |
| 36 | <root BTCPP_format="4"> |
| 37 | <BehaviorTree> |
| 38 | <TryCatch> |
| 39 | <TestA/> |
| 40 | <TestB/> |
| 41 | <TestC/> <!-- catch --> |
| 42 | </TryCatch> |
| 43 | </BehaviorTree> |
| 44 | </root>)"; |
| 45 | |
| 46 | auto tree = factory.createTreeFromText(xml_text); |
| 47 | auto status = tree.tickWhileRunning(); |
| 48 | |
| 49 | ASSERT_EQ(status, NodeStatus::SUCCESS); |
| 50 | ASSERT_EQ(counters[0], 1); // TestA executed |
| 51 | ASSERT_EQ(counters[1], 1); // TestB executed |
| 52 | ASSERT_EQ(counters[2], 0); // TestC (catch) NOT executed |
| 53 | } |
| 54 | |
| 55 | TEST_F(TryCatchTest, FirstChildFails_CatchExecuted) |
| 56 | { |
nothing calls this directly
no test coverage detected