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

Function TEST_F

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

Source from the content-addressed store, hash-verified

31};
32
33TEST_F(TryCatchTest, AllTryChildrenSucceed)
34{
35 const std::string xml_text = R"(
36 <root BTCPP_format="4">
37 <BehaviorTree>
38 <TryCatch>
39 <TestA/>
40 <TestB/>
41 <TestC/> <!-- catch -->
42 </TryCatch>
43 </BehaviorTree>
44 </root>)";
45
46 auto tree = factory.createTreeFromText(xml_text);
47 auto status = tree.tickWhileRunning();
48
49 ASSERT_EQ(status, NodeStatus::SUCCESS);
50 ASSERT_EQ(counters[0], 1); // TestA executed
51 ASSERT_EQ(counters[1], 1); // TestB executed
52 ASSERT_EQ(counters[2], 0); // TestC (catch) NOT executed
53}
54
55TEST_F(TryCatchTest, FirstChildFails_CatchExecuted)
56{

Callers

nothing calls this directly

Calls 6

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

Tested by

no test coverage detected