Skip to content

Commit 78be587

Browse files
Applies consistent code formatting
Adjusts line wrapping and whitespace across examples, headers, source files, and tests to enhance readability and maintain a unified code style.
1 parent b913c89 commit 78be587

File tree

6 files changed

+21
-24
lines changed

6 files changed

+21
-24
lines changed

examples/t15_nodes_mocking.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,10 +104,9 @@ int main(int /*argc*/, char** /*argv*/)
104104
// This is the configuration passed to the TestNode
105105
BT::TestNodeConfig test_config;
106106
// the returned status can also be computed from a script.
107-
// Change mock_should_fail to true in the XML above to see the failure path.
107+
// Change mock_should_fail to true in the XML above to see the failure path.
108108
test_config.return_status.reset();
109-
test_config.return_status_script =
110-
"(mock_should_fail == true) ? FAILURE : SUCCESS";
109+
test_config.return_status_script = "(mock_should_fail == true) ? FAILURE : SUCCESS";
111110
// Convert the node in asynchronous and wait 2000 ms
112111
test_config.async_delay = std::chrono::milliseconds(2000);
113112
// Execute a different script depending on the resolved return status.

examples/t15_nodes_mocking_strict_failure.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,7 @@ int main(int /*argc*/, char** /*argv*/)
7979

8080
BT::TestNodeConfig test_config;
8181
test_config.return_status.reset();
82-
test_config.return_status_script =
83-
"(mock_should_fail == true) ? FAILURE : SUCCESS";
82+
test_config.return_status_script = "(mock_should_fail == true) ? FAILURE : SUCCESS";
8483
test_config.async_delay = std::chrono::milliseconds(2000);
8584
test_config.success_script = "msg := 'message SUBSTITUTED' ";
8685
test_config.failure_script = "msg := 'message FAILURE branch' ";

include/behaviortree_cpp/actions/test_node.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@
1313

1414
#pragma once
1515

16-
#include <memory>
17-
#include <optional>
18-
#include <string>
19-
2016
#include "behaviortree_cpp/action_node.h"
2117
#include "behaviortree_cpp/scripting/script_parser.hpp"
2218
#include "behaviortree_cpp/utils/timer_queue.h"
2319

20+
#include <memory>
21+
#include <optional>
22+
#include <string>
23+
2424
namespace BT
2525
{
2626

src/actions/test_node.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ void validateTestNodeStatus(NodeStatus status, StringView source)
3333

3434
EnumsTablePtr createTestNodeEnums(const EnumsTablePtr& base_enums)
3535
{
36-
auto enums = base_enums ? std::make_shared<EnumsTable>(*base_enums)
37-
: std::make_shared<EnumsTable>();
36+
auto enums = base_enums ? std::make_shared<EnumsTable>(*base_enums) :
37+
std::make_shared<EnumsTable>();
3838

3939
(*enums)["IDLE"] = static_cast<int>(NodeStatus::IDLE);
4040
(*enums)["RUNNING"] = static_cast<int>(NodeStatus::RUNNING);
@@ -90,8 +90,8 @@ TestNode::TestNode(const std::string& name, const NodeConfig& config,
9090
if(!_config->complete_func && !_config->return_status &&
9191
_config->return_status_script.empty())
9292
{
93-
throw RuntimeError(
94-
"TestNode requires one of complete_func, return_status, or return_status_script");
93+
throw RuntimeError("TestNode requires one of complete_func, return_status, or "
94+
"return_status_script");
9595
}
9696

9797
_script_enums = createTestNodeEnums(config.enums);
@@ -170,8 +170,8 @@ NodeStatus TestNode::onCompleted()
170170
}
171171
else
172172
{
173-
throw RuntimeError(
174-
"TestNode requires one of complete_func, return_status, or return_status_script");
173+
throw RuntimeError("TestNode requires one of complete_func, return_status, or "
174+
"return_status_script");
175175
}
176176

177177
validateTestNodeStatus(status, "completion");

src/bt_factory.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -540,7 +540,8 @@ void BehaviorTreeFactory::loadSubstitutionRuleFromJSON(const std::string& json_t
540540
}
541541
if(test_config.contains("return_status_script"))
542542
{
543-
config.return_status_script = test_config["return_status_script"].get<std::string>();
543+
config.return_status_script =
544+
test_config["return_status_script"].get<std::string>();
544545
}
545546
if(test_config.contains("async_delay"))
546547
{

tests/gtest_substitution.cpp

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,8 @@ TEST(Substitution, Parser)
6565

6666
auto configScript = std::get_if<TestNodeConfig>(&rules.at("actionD"));
6767
ASSERT_FALSE(configScript->return_status.has_value());
68-
ASSERT_EQ(configScript->return_status_script,
69-
"(mock_should_fail == true) ? FAILURE : SUCCESS");
68+
ASSERT_EQ(configScript->return_status_script, "(mock_should_fail == true) ? FAILURE : "
69+
"SUCCESS");
7070
ASSERT_EQ(configScript->failure_script, "branch := 'failure'");
7171

7272
ASSERT_EQ(*std::get_if<std::string>(&rules.at("actionC")), "NotAConfig");
@@ -148,8 +148,7 @@ TEST(Substitution, ScriptedReturnStatusOverridesFixedStatus)
148148

149149
TestNodeConfig test_config;
150150
test_config.return_status = NodeStatus::SUCCESS;
151-
test_config.return_status_script =
152-
"(mock_should_fail == true) ? FAILURE : SUCCESS";
151+
test_config.return_status_script = "(mock_should_fail == true) ? FAILURE : SUCCESS";
153152
test_config.failure_script = "branch := 'failure'";
154153
factory.addSubstitutionRule("action_A", test_config);
155154

@@ -178,8 +177,7 @@ TEST(Substitution, ScriptedReturnStatusAsyncSubstitution)
178177

179178
TestNodeConfig test_config;
180179
test_config.return_status.reset();
181-
test_config.return_status_script =
182-
"(mock_should_fail == true) ? FAILURE : SUCCESS";
180+
test_config.return_status_script = "(mock_should_fail == true) ? FAILURE : SUCCESS";
183181
test_config.async_delay = std::chrono::milliseconds(50);
184182
factory.addSubstitutionRule("action_A", test_config);
185183

@@ -188,8 +186,8 @@ TEST(Substitution, ScriptedReturnStatusAsyncSubstitution)
188186
std::async(std::launch::async, [&tree]() { return tree.tickWhileRunning(); });
189187

190188
auto status = future.wait_for(std::chrono::seconds(5));
191-
ASSERT_NE(status, std::future_status::timeout)
192-
<< "Tree hung! tickWhileRunning did not complete within 5 seconds";
189+
ASSERT_NE(status, std::future_status::timeout) << "Tree hung! tickWhileRunning did not "
190+
"complete within 5 seconds";
193191
ASSERT_EQ(future.get(), NodeStatus::SUCCESS);
194192
}
195193

0 commit comments

Comments
 (0)