| 11 | using namespace BT; |
| 12 | |
| 13 | TEST(SkippingLogic, Sequence) |
| 14 | { |
| 15 | BehaviorTreeFactory factory; |
| 16 | std::array<int, 2> counters{}; |
| 17 | RegisterTestTick(factory, "Test", counters); |
| 18 | |
| 19 | const std::string xml_text = R"( |
| 20 | |
| 21 | <root BTCPP_format="4" > |
| 22 | <BehaviorTree ID="MainTree"> |
| 23 | <Sequence> |
| 24 | <Script code = "A:=1"/> |
| 25 | <TestA _successIf="A==2" _failureIf="A!=1" _skipIf="A==1"/> |
| 26 | <TestB/> |
| 27 | </Sequence> |
| 28 | </BehaviorTree> |
| 29 | </root>)"; |
| 30 | |
| 31 | auto tree = factory.createTreeFromText(xml_text); |
| 32 | const auto status = tree.tickWhileRunning(); |
| 33 | ASSERT_EQ(status, NodeStatus::SUCCESS); |
| 34 | ASSERT_EQ(counters[0], 0); |
| 35 | ASSERT_EQ(counters[1], 1); |
| 36 | } |
| 37 | |
| 38 | TEST(SkippingLogic, SkipAll) |
| 39 | { |
nothing calls this directly
no test coverage detected