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

Function TEST_F

tests/gtest_while_do_else.cpp:33–53  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

31};
32
33TEST_F(WhileDoElseTest, ConditionTrue_DoBranch)
34{
35 // When condition is true, execute the "do" branch
36 const std::string xml_text = R"(
37 <root BTCPP_format="4">
38 <BehaviorTree>
39 <WhileDoElse>
40 <AlwaysSuccess/> <!-- condition -->
41 <TestA/> <!-- do -->
42 <TestB/> <!-- else -->
43 </WhileDoElse>
44 </BehaviorTree>
45 </root>)";
46
47 auto tree = factory.createTreeFromText(xml_text);
48 auto status = tree.tickWhileRunning();
49
50 ASSERT_EQ(status, NodeStatus::SUCCESS);
51 ASSERT_EQ(counters[0], 1); // TestA executed
52 ASSERT_EQ(counters[1], 0); // TestB not executed
53}
54
55TEST_F(WhileDoElseTest, ConditionFalse_ElseBranch)
56{

Callers

nothing calls this directly

Calls 5

createTreeFromTextMethod · 0.80
tickWhileRunningMethod · 0.80
haltTreeMethod · 0.80
tickOnceMethod · 0.80

Tested by

no test coverage detected