Skip to content

Commit

Permalink
Do not compile assert death tests in Release builds. (#393)
Browse files Browse the repository at this point in the history
Signed-off-by: Michel Hidalgo <michel@ekumenlabs.com>
  • Loading branch information
hidmic authored May 28, 2020
1 parent 56172ef commit 08a51c2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions rmw_fastrtps_shared_cpp/test/test_guid_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,14 @@ static constexpr size_t byte_array_size =
eprosima::fastrtps::rtps::EntityId_t::size;

TEST(GUIDUtilsTest, bad_arguments) {
#ifndef NDEBUG
eprosima::fastrtps::rtps::GUID_t guid;
uint8_t byte_array[byte_array_size] = {0};
uint8_t * null_byte_array = nullptr;
EXPECT_DEATH(copy_from_byte_array_to_fastrtps_guid(byte_array, nullptr), "");
EXPECT_DEATH(copy_from_byte_array_to_fastrtps_guid(null_byte_array, &guid), "");
EXPECT_DEATH(copy_from_fastrtps_guid_to_byte_array(guid, null_byte_array), "");
#endif
}

TEST(GUIDUtilsTest, byte_array_to_guid_and_back) {
Expand Down
2 changes: 2 additions & 0 deletions rmw_fastrtps_shared_cpp/test/test_names.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,11 @@ TEST(NamespaceTest, name_mangling) {
rmw_qos_profile_t qos_profile = rmw_qos_profile_unknown;
qos_profile.avoid_ros_namespace_conventions = false;

#ifndef NDEBUG
EXPECT_DEATH(_create_topic_name(nullptr, "", "", ""), "");

EXPECT_DEATH(_create_topic_name(&qos_profile, "", nullptr, ""), "");
#endif

EXPECT_STREQ(
"some_ros_prefix/test__suffix", _create_topic_name(
Expand Down

0 comments on commit 08a51c2

Please sign in to comment.