Skip to content

Commit 55a7b70

Browse files
committed
fix unit test
1 parent ead514d commit 55a7b70

File tree

4 files changed

+12
-16
lines changed

4 files changed

+12
-16
lines changed

CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,10 @@ endif()
1919
if(MSVC)
2020
add_definitions(-D_CRT_SECURE_NO_WARNINGS -DWIN32_LEAN_AND_MEAN)
2121
else()
22-
add_definitions(-Wpedantic)
22+
add_definitions(-Wpedantic -fno-omit-frame-pointer)
2323
endif()
2424

25+
2526
#---- project configuration ----
2627
option(BTCPP_SHARED_LIBS "Build shared libraries" ON)
2728
option(BTCPP_BUILD_TOOLS "Build commandline tools" ON)

include/behaviortree_cpp/blackboard.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,6 @@ inline void Blackboard::set(const std::string& key, const T& value)
201201
}
202202
lock.lock();
203203

204-
storage_.insert({ key, entry });
205204
entry->value = new_value;
206205
}
207206
else

src/blackboard.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -210,31 +210,31 @@ std::shared_ptr<Blackboard::Entry> Blackboard::createEntryImpl(const std::string
210210
return storage_it->second;
211211
}
212212

213-
std::shared_ptr<Entry> entry;
214-
215213
// manual remapping first
216214
auto remapping_it = internal_to_external_.find(key);
217215
if(remapping_it != internal_to_external_.end())
218216
{
219217
const auto& remapped_key = remapping_it->second;
220218
if(auto parent = parent_bb_.lock())
221219
{
222-
entry = parent->createEntryImpl(remapped_key, info);
220+
return parent->createEntryImpl(remapped_key, info);
223221
}
222+
throw RuntimeError("Missing parent blackboard");
224223
}
225-
else if(autoremapping_ && !IsPrivateKey(key))
224+
// autoremapping second (excluding private keys)
225+
if(autoremapping_ && !IsPrivateKey(key))
226226
{
227227
if(auto parent = parent_bb_.lock())
228228
{
229229
return parent->createEntryImpl(key, info);
230230
}
231+
throw RuntimeError("Missing parent blackboard");
231232
}
232-
else // not remapped, not found. Create locally.
233-
{
234-
entry = std::make_shared<Entry>(info);
235-
// even if empty, let's assign to it a default type
236-
entry->value = Any(info.type());
237-
}
233+
// not remapped, not found. Create locally.
234+
235+
auto entry = std::make_shared<Entry>(info);
236+
// even if empty, let's assign to it a default type
237+
entry->value = Any(info.type());
238238
storage_.insert({ key, entry });
239239
return entry;
240240
}

tests/gtest_blackboard.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,8 @@
1111
*/
1212

1313
#include <gtest/gtest.h>
14-
#include "action_test_node.h"
15-
#include "condition_test_node.h"
16-
#include "behaviortree_cpp/behavior_tree.h"
1714
#include "behaviortree_cpp/bt_factory.h"
1815
#include "behaviortree_cpp/blackboard.h"
19-
#include "behaviortree_cpp/xml_parsing.h"
2016

2117
#include "../sample_nodes/dummy_nodes.h"
2218

0 commit comments

Comments
 (0)