| 94 | } // namespace |
| 95 | |
| 96 | TEST(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 | |
| 121 | TEST(CoroTest, do_action_timeout) |
| 122 | { |
nothing calls this directly
no test coverage detected