Skip to content

Commit 5d7965a

Browse files
committed
fix unit tests in Windows
1 parent 36489e6 commit 5d7965a

File tree

4 files changed

+15
-8
lines changed

4 files changed

+15
-8
lines changed

include/behaviortree_cpp/json_export.h

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,7 @@ namespace BT
4949
class JsonExporter
5050
{
5151
public:
52-
static JsonExporter& get()
53-
{
54-
static JsonExporter global_instance;
55-
return global_instance;
56-
}
52+
static JsonExporter& get();
5753

5854
/**
5955
* @brief toJson adds the content of "any" to the JSON "destination".

src/json_export.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@
33
namespace BT
44
{
55

6+
JsonExporter &JsonExporter::get()
7+
{
8+
static JsonExporter global_instance;
9+
return global_instance;
10+
}
11+
612
bool JsonExporter::toJson(const Any& any, nlohmann::json& dst) const
713
{
814
nlohmann::json json;

tests/gtest_blackboard.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -531,10 +531,15 @@ TEST(BlackboardTest, BlackboardBackup)
531531
// Blackboard Backup
532532
const auto bb_backup = BlackboardBackup(tree);
533533

534-
std::vector<std::vector<StringView>> expected_keys;
534+
std::vector<std::vector<std::string>> expected_keys;
535535
for(const auto& sub : tree.subtrees)
536536
{
537-
expected_keys.push_back(sub->blackboard->getKeys());
537+
std::vector<std::string> keys;
538+
for(const auto& str_view : sub->blackboard->getKeys())
539+
{
540+
keys.push_back(std::string(str_view));
541+
}
542+
expected_keys.push_back(keys);
538543
}
539544

540545
auto status = tree.tickWhileRunning();

tests/gtest_ports.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -510,7 +510,7 @@ class NodeWithDefaultPoints : public SyncActionNode
510510
}
511511
if(!getInput("pointE", pointE) || pointE != Point2D{ 9, 10 })
512512
{
513-
throw std::runtime_error("failed pointD");
513+
throw std::runtime_error("failed pointE");
514514
}
515515
if(!getInput("input", input) || input != Point2D{ -1, -2 })
516516
{

0 commit comments

Comments
 (0)