Skip to content

Commit

Permalink
Test for setting a global blackboard entry using a node's output port (
Browse files Browse the repository at this point in the history
…#824)

* Add test for setting a global blackboard entry using a node's output port #823

* Add quotes to variable var5
  • Loading branch information
robin-mueller authored May 20, 2024
1 parent 287eb59 commit 6a184bf
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions tests/gtest_blackboard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -583,18 +583,26 @@ TEST(BlackboardTest, RootBlackboard)
</Sequence>
</BehaviorTree>
<BehaviorTree ID="Sub_Issue823">
<BB_TestNode in_port="2" out_port="{@var5}" />
</BehaviorTree>
<BehaviorTree ID="MainTree">
<Sequence>
<Script code=" msg:='hello' " />
<SubTree ID="SubA" />
<Script code="@var5:=0" />
<SubTree ID="Sub_Issue823" />
<Script code=" var1:=1 " />
<Script code=" @var2:=2 " />
</Sequence>
</BehaviorTree>
</root> )";

factory.registerNodeType<DummyNodes::SaySomething>("SaySomething");
factory.registerNodeType<BB_TestNode>("BB_TestNode");
factory.registerBehaviorTreeFromText(xml_text);
auto tree = factory.createTree("MainTree");

Expand All @@ -605,6 +613,7 @@ TEST(BlackboardTest, RootBlackboard)
ASSERT_EQ(2, tree.rootBlackboard()->get<int>("var2"));
ASSERT_EQ(3, tree.rootBlackboard()->get<int>("var3"));
ASSERT_EQ(4, tree.rootBlackboard()->get<int>("var4"));
ASSERT_EQ(4, tree.rootBlackboard()->get<int>("var5"));
}

TEST(BlackboardTest, TimestampedInterface)
Expand Down

0 comments on commit 6a184bf

Please sign in to comment.