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

Function checkLevel

tests/script_parser_test.cpp:318–333  ·  view source on GitHub ↗

NOLINTNEXTLINE(misc-use-anonymous-namespace,misc-use-internal-linkage)

Source from the content-addressed store, hash-verified

316
317// NOLINTNEXTLINE(misc-use-anonymous-namespace,misc-use-internal-linkage)
318BT::NodeStatus checkLevel(BT::TreeNode& self)
319{
320 double percent = self.getInput<double>("percentage").value();
321 DeviceType devType{};
322 auto res = self.getInput("deviceType", devType);
323 if(!res)
324 {
325 throw std::runtime_error(res.error());
326 }
327
328 if(devType == DeviceType::BATT)
329 {
330 self.setOutput("isLowBattery", (percent < 25));
331 }
332 return BT::NodeStatus::SUCCESS;
333}
334
335TEST(ParserTest, Enums_Issue_523)
336{

Callers

nothing calls this directly

Calls 3

setOutputMethod · 0.80
valueMethod · 0.45
getInputMethod · 0.45

Tested by

no test coverage detected