Skip to content

Commit 5d316db

Browse files
committed
Fix CI
1 parent e2b0420 commit 5d316db

File tree

4 files changed

+16
-5
lines changed

4 files changed

+16
-5
lines changed

include/behaviortree_cpp/blackboard.h

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,18 @@ struct is_vector<std::vector<T, A>> : std::true_type
4040
// Helper function to check if a demangled type string is a std::vector<..>
4141
inline bool isVector(const std::string& type_name)
4242
{
43-
return std::regex_match(type_name, std::regex(R"(^std::vector<.*>$)"));
43+
// Strip leading MSVC qualifiers "class " or "struct ".
44+
std::string name = type_name;
45+
constexpr auto strip_prefix = [](std::string& s, const char* prefix) {
46+
size_t len = std::strlen(prefix);
47+
if(s.rfind(prefix, 0) == 0)
48+
s.erase(0, len);
49+
};
50+
strip_prefix(name, "class ");
51+
strip_prefix(name, "struct ");
52+
53+
// Use regex to check if the name matches 'std::vector<...>'.
54+
return std::regex_match(name, std::regex(R"(^std::vector<.*>$)"));
4455
}
4556

4657
/**

tests/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ set(BT_TESTS
3636

3737
if(ament_cmake_FOUND)
3838

39-
find_package(ament_cmake_gmock REQUIRED)
39+
find_package(ament_cmake_gtest REQUIRED)
4040

41-
ament_add_gmock(${BTCPP_LIBRARY}_test ${BT_TESTS})
41+
ament_add_gtest(${BTCPP_LIBRARY}_test ${BT_TESTS})
4242
target_link_libraries(${BTCPP_LIBRARY}_test
4343
${TEST_DEPENDECIES}
4444
${ament_LIBRARIES})

tests/gtest_json.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ TEST_F(JsonTest, TwoWaysConversion)
147147
ASSERT_EQ(string_val, "string_val");
148148
auto int_val = exporter.fromJson(json["int"])->first.cast<int>();
149149
ASSERT_EQ(int_val, 69);
150-
auto uint_val = exporter.fromJson(json["uint"])->first.cast<uint>();
150+
auto uint_val = exporter.fromJson(json["uint"])->first.cast<uint64_t>();
151151
ASSERT_EQ(uint_val, 96);
152152
auto real = exporter.fromJson(json["real"])->first.cast<double>();
153153
ASSERT_EQ(real, 3.14);

tests/gtest_ports.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -855,7 +855,7 @@ TEST(PortTest, VectorAny)
855855
ASSERT_NO_THROW(status = tree.tickOnce());
856856
ASSERT_EQ(status, NodeStatus::SUCCESS);
857857

858-
// Test that setting a port as a vector<string> and attempting to retrie it as a vector<double> fails.
858+
// Test that setting a port as a vector<string> and attempting to retrieve it as a vector<double> fails.
859859
ASSERT_NO_THROW(tree = factory.createTreeFromText(xml_txt_bad));
860860

861861
ASSERT_NO_THROW(status = tree.tickOnce());

0 commit comments

Comments
 (0)