Skip to content

Commit

Permalink
Change allocator call
Browse files Browse the repository at this point in the history
Signed-off-by: Jorge Perez <jjperez@ekumenlabs.com>
  • Loading branch information
Blast545 committed Aug 13, 2020
1 parent bbe6241 commit ecedb50
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions rcl/test/rcl/test_rmw_impl_id_check_func.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,15 +123,15 @@ TEST(TestRmwCheck, test_mock_rmw_impl_check) {
const char * get_env_id_matches_name = rcutils_get_env(
RCL_ASSERT_RMW_ID_MATCHES_ENV_VAR_NAME,
&expected_rmw_id_matches);
EXPECT_FALSE(get_env_id_matches_name);
EXPECT_EQ(NULL, get_env_id_matches_name);
EXPECT_TRUE(rcutils_set_env(RCL_ASSERT_RMW_ID_MATCHES_ENV_VAR_NAME, "some_random_name"));

// Return an allocated string as strdup would do for the first case
// calling the function
rcl_allocator_t allocator = rcl_get_default_allocator();
size_t dummy_str_size = 3u;
char * new_string = static_cast<char *>(allocator.allocate(dummy_str_size, allocator.state));
memset(new_string, '\0', dummy_str_size);
char * new_string = static_cast<char *>(allocator.zero_allocate(
dummy_str_size, 1u, allocator.state));

auto mock = mocking_utils::patch(
"lib:rcl", rcutils_strdup, [&new_string](auto...) {
Expand Down

0 comments on commit ecedb50

Please sign in to comment.