Skip to content

Commit ff029cc

Browse files
author
AndyZe
committed
Add a unit test
1 parent ff14d91 commit ff029cc

File tree

2 files changed

+29
-1
lines changed

2 files changed

+29
-1
lines changed

src/xml_parsing.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -548,7 +548,7 @@ void VerifyXML(const std::string& xml_text,
548548
auto child_type = child_search->second;
549549
if(child_type == NodeType::CONTROL &&
550550
((child_name == "ThreadedAction") || (child_name == "StatefulActionNode") ||
551-
(child_name == "CoroActionNode")))
551+
(child_name == "CoroActionNode") || (child_name == "AsyncSequence")))
552552
{
553553
ThrowError(line_number, std::string("The first child of a ReactiveSequence "
554554
"cannot be asynchronous"));

tests/gtest_reactive.cpp

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,3 +156,31 @@ TEST(Reactive, TestLogging)
156156
ASSERT_EQ(observer.getStatistics("testA").success_count, num_ticks);
157157
ASSERT_EQ(observer.getStatistics("success").success_count, num_ticks);
158158
}
159+
160+
TEST(Reactive, TwoAsyncNodesInReactiveSequence)
161+
{
162+
static const char* reactive_xml_text = R"(
163+
<root BTCPP_format="4" >
164+
<BehaviorTree ID="MainTree">
165+
<ReactiveSequence>
166+
<AsyncSequence name="first">
167+
<TestA/>
168+
<TestB/>
169+
<TestC/>
170+
</AsyncSequence>
171+
<AsyncSequence name="second">
172+
<TestD/>
173+
<TestE/>
174+
<TestF/>
175+
</AsyncSequence>
176+
</ReactiveSequence>
177+
</BehaviorTree>
178+
</root>
179+
)";
180+
181+
BT::BehaviorTreeFactory factory;
182+
std::array<int, 6> counters;
183+
RegisterTestTick(factory, "Test", counters);
184+
185+
EXPECT_ANY_THROW(auto tree = factory.createTreeFromText(reactive_xml_text));
186+
}

0 commit comments

Comments
 (0)