| 12 | using namespace BT; |
| 13 | |
| 14 | TEST(SubTree, SiblingPorts_Issue_72) |
| 15 | { |
| 16 | static const char* xml_text = R"( |
| 17 | |
| 18 | <root BTCPP_format="4" main_tree_to_execute="MainTree" > |
| 19 | |
| 20 | <BehaviorTree ID="MainTree"> |
| 21 | <Sequence> |
| 22 | <Script code = " myParam = 'hello' " /> |
| 23 | <SubTree ID="mySubtree" param="{myParam}" /> |
| 24 | <Script code = " myParam = 'world' " /> |
| 25 | <SubTree ID="mySubtree" param="{myParam}" /> |
| 26 | </Sequence> |
| 27 | </BehaviorTree> |
| 28 | |
| 29 | <BehaviorTree ID="mySubtree"> |
| 30 | <SaySomething message="{param}" /> |
| 31 | </BehaviorTree> |
| 32 | </root> )"; |
| 33 | |
| 34 | BehaviorTreeFactory factory; |
| 35 | factory.registerNodeType<DummyNodes::SaySomething>("SaySomething"); |
| 36 | |
| 37 | Tree tree = factory.createTreeFromText(xml_text); |
| 38 | |
| 39 | for(auto& subtree : tree.subtrees) |
| 40 | { |
| 41 | subtree->blackboard->debugMessage(); |
| 42 | std::cout << "-----" << std::endl; |
| 43 | } |
| 44 | |
| 45 | auto status = tree.tickWhileRunning(); |
| 46 | ASSERT_EQ(status, NodeStatus::SUCCESS); |
| 47 | ASSERT_EQ(tree.subtrees.size(), 3); |
| 48 | } |
| 49 | |
| 50 | class CopyPorts : public BT::SyncActionNode |
| 51 | { |
nothing calls this directly
no test coverage detected