Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
Signed-off-by: Lucia Echevarria <luciaechevarria@eprosima.com>
  • Loading branch information
LuciaEchevarria99 committed Aug 16, 2024
1 parent c0d522a commit 0aa412a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 49 deletions.
4 changes: 3 additions & 1 deletion ddspipe_core/src/cpp/types/dynamic_types/schema_msg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,9 @@ std::string type_kind_to_str(
case fastdds::dds::xtypes::TK_FLOAT64:
return "float64";

case fastdds::dds::xtypes::TK_CHAR8:
return "int8";

case fastdds::dds::xtypes::TK_STRING8:
return "string";

Expand All @@ -211,7 +214,6 @@ std::string type_kind_to_str(
return utils::demangle_if_ros_type((dyn_type->get_name()).to_string());

case fastdds::dds::xtypes::TK_FLOAT128:
case fastdds::dds::xtypes::TK_CHAR8:
case fastdds::dds::xtypes::TK_CHAR16:
case fastdds::dds::xtypes::TK_STRING16:
case fastdds::dds::xtypes::TK_ENUM:
Expand Down
6 changes: 4 additions & 2 deletions ddspipe_core/test/unittest/efficiency/PayloadPoolTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,6 @@ class MockPayloadPool : public PayloadPool

// Using parent methods and variables as public
using PayloadPool::PayloadPool;
using PayloadPool::get_payload;
using PayloadPool::release_payload;
using PayloadPool::reserve_;
using PayloadPool::release_;
using PayloadPool::reserve_count_;
Expand Down Expand Up @@ -137,6 +135,8 @@ TEST(PayloadPoolTest, reserve)

// This would (maybe) fail with SEG FAULT if the data has not been correctly set
payload.data[0] = 16u;

ASSERT_TRUE(pool.release_(payload));
}

// large size
Expand All @@ -155,6 +155,8 @@ TEST(PayloadPoolTest, reserve)
// This would (maybe) fail with SEG FAULT if the data has not been correctly set
payload.data[0] = 4u;
payload.data[0x1000 - 1] = 5u;

ASSERT_TRUE(pool.release_(payload));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,25 +50,6 @@ TEST(YamlGetEntityDiscoveryServerAddressTest, get_ds_address_negative)
eprosima::utils::ConfigurationException);
}

// no guid prefix
{
Yaml yml_ds_address;

// Get random address and add it to yaml
participants::types::Address address = eprosima::ddspipe::participants::testing::random_address();
Yaml yml_addresses;
Yaml yml_address;
ddspipe::yaml::testing::address_to_yaml(yml_address, address);
yml_addresses.push_back(yml_address);
yml_ds_address[COLLECTION_ADDRESSES_TAG] = yml_addresses;

Yaml yml;
yml["connection-address"] = yml_ds_address;
ASSERT_THROW(
YamlReader::get<participants::types::DiscoveryServerConnectionAddress>(yml, "connection-address", LATEST),
eprosima::utils::ConfigurationException);
}

// no addresses
{
Yaml yml_ds_address;
Expand All @@ -86,33 +67,6 @@ TEST(YamlGetEntityDiscoveryServerAddressTest, get_ds_address_negative)
eprosima::utils::ConfigurationException);
}

// error format in guid prefix
{
Yaml yml_ds_address;

// Get random address and add it to yaml
participants::types::Address address = eprosima::ddspipe::participants::testing::random_address();
Yaml yml_addresses;
Yaml yml_address;
ddspipe::yaml::testing::address_to_yaml(yml_address, address);
yml_addresses.push_back(yml_address);
yml_ds_address[COLLECTION_ADDRESSES_TAG] = yml_addresses;

// Guid Prefix error format (inside a sequence)
core::types::GuidPrefix guid_prefix = eprosima::ddspipe::core::testing::random_guid_prefix();
Yaml yml_guid;
guid_prefix_to_yaml(yml_guid, guid_prefix);
Yaml yml_guid_aux;
yml_guid_aux.push_back(yml_guid);
yml_ds_address[DISCOVERY_SERVER_GUID_PREFIX_TAG] = yml_guid_aux;

Yaml yml;
yml["connection-address"] = yml_ds_address;
ASSERT_THROW(
YamlReader::get<participants::types::DiscoveryServerConnectionAddress>(yml, "connection-address", LATEST),
eprosima::utils::ConfigurationException);
}

// error format in addresses
{
Yaml yml_ds_address;
Expand Down

0 comments on commit 0aa412a

Please sign in to comment.