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

Function TEST

tests/gtest_coroutines.cpp:96–119  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

94} // namespace
95
96TEST(CoroTest, do_action)
97{
98 BT::NodeConfig node_config_;
99 node_config_.blackboard = BT::Blackboard::create();
100 BT::assignDefaultRemapping<SimpleCoroAction>(node_config_);
101 SimpleCoroAction node(MEDIUM_ACTION_DURATION, false, "Action", node_config_);
102
103 EXPECT_EQ(BT::NodeStatus::SUCCESS, executeWhileRunning(node));
104 EXPECT_FALSE(node.wasHalted());
105
106 EXPECT_EQ(BT::NodeStatus::SUCCESS, executeWhileRunning(node)) << "Second call to coro "
107 "action";
108 EXPECT_FALSE(node.wasHalted());
109
110 node.will_fail_ = true;
111 EXPECT_EQ(BT::NodeStatus::FAILURE, executeWhileRunning(node)) << "Should execute again "
112 "and return failure";
113 EXPECT_FALSE(node.wasHalted());
114
115 EXPECT_EQ(BT::NodeStatus::FAILURE, executeWhileRunning(node)) << "Shouldn't fail "
116 "because we set "
117 "status to idle";
118 EXPECT_FALSE(node.wasHalted());
119}
120
121TEST(CoroTest, do_action_timeout)
122{

Callers

nothing calls this directly

Calls 9

createFunction · 0.85
executeWhileRunningFunction · 0.85
setChildMethod · 0.80
setRequiredTimeMethod · 0.80
addChildMethod · 0.80
waitMethod · 0.80
wasHaltedMethod · 0.45
executeTickMethod · 0.45
haltMethod · 0.45

Tested by

no test coverage detected