MCPcopy Create free account
hub / github.com/BehaviorTree/BehaviorTree.CPP / TEST

Function TEST

tests/gtest_subtree.cpp:14–48  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

12using namespace BT;
13
14TEST(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
50class CopyPorts : public BT::SyncActionNode
51{

Callers

nothing calls this directly

Calls 13

createFunction · 0.85
RegisterTestTickFunction · 0.85
createTreeFromTextMethod · 0.80
debugMessageMethod · 0.80
tickWhileRunningMethod · 0.80
createTreeMethod · 0.80
setMethod · 0.80
tickOnceMethod · 0.80
applyVisitorMethod · 0.80
sizeMethod · 0.45
whatMethod · 0.45

Tested by

no test coverage detected