Skip to content

Commit

Permalink
Add death tests.
Browse files Browse the repository at this point in the history
Signed-off-by: Michel Hidalgo <michel@ekumenlabs.com>
  • Loading branch information
hidmic committed May 18, 2020
1 parent d54d48e commit 7bcd434
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions rmw_fastrtps_shared_cpp/test/test_guid_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,15 @@ static constexpr size_t byte_array_size =
eprosima::fastrtps::rtps::GuidPrefix_t::size +
eprosima::fastrtps::rtps::EntityId_t::size;

TEST(GUIDUtilsTest, bad_arguments) {
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), "guid");
EXPECT_DEATH(copy_from_byte_array_to_fastrtps_guid(null_byte_array, &guid), "byte_array");
EXPECT_DEATH(copy_from_fastrtps_guid_to_byte_array(guid, null_byte_array), "byte_array");
}

TEST(GUIDUtilsTest, byte_array_to_guid_and_back) {
uint8_t input_byte_array[byte_array_size] = {0};
input_byte_array[0] = 0xA5;
Expand Down

0 comments on commit 7bcd434

Please sign in to comment.