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

Function TEST

tests/gtest_skipping.cpp:13–36  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

11using namespace BT;
12
13TEST(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
38TEST(SkippingLogic, SkipAll)
39{

Callers

nothing calls this directly

Calls 11

RegisterTestTickFunction · 0.85
createFunction · 0.85
isStatusCompletedFunction · 0.85
createTreeFromTextMethod · 0.80
tickWhileRunningMethod · 0.80
setMethod · 0.80
createTreeMethod · 0.80
tickOnceMethod · 0.80
sleepMethod · 0.80
rootBlackboardMethod · 0.45

Tested by

no test coverage detected