From fd95613f020a2f0a4d4463f9c59fae7b6918edb4 Mon Sep 17 00:00:00 2001 From: JLBuenoLopez-eProsima Date: Wed, 3 Apr 2024 08:19:24 +0200 Subject: [PATCH] Refs #20424: Added test for appendable. Signed-off-by: adriancampo --- test/feature/dynamic_types/CMakeLists.txt | 13 +- .../DynamicTypesDDSTypesTest.hpp | 1 + .../DynamicTypesAppendableDDSTypesTests.cpp | 925 ++++++++++++++++++ .../DynamicTypesStructuresDDSTypesTests.cpp | 1 - 4 files changed, 933 insertions(+), 7 deletions(-) create mode 100644 test/feature/dynamic_types/dds_types_tests/DynamicTypesAppendableDDSTypesTests.cpp diff --git a/test/feature/dynamic_types/CMakeLists.txt b/test/feature/dynamic_types/CMakeLists.txt index 55b8f813377..83ed79383d5 100644 --- a/test/feature/dynamic_types/CMakeLists.txt +++ b/test/feature/dynamic_types/CMakeLists.txt @@ -23,6 +23,7 @@ set(DYNAMIC_TYPES_DDS_TYPES_TEST_SOURCE DynamicTypesDDSTypesTest.cpp dds_types_tests/DynamicTypesAliasesDDSTypesTests.cpp dds_types_tests/DynamicTypesAnnotationsDDSTypesTests.cpp + dds_types_tests/DynamicTypesAppendableDDSTypesTests.cpp dds_types_tests/DynamicTypesArraysDDSTypesTests.cpp dds_types_tests/DynamicTypesBitsetsDDSTypesTests.cpp dds_types_tests/DynamicTypesEnumerationsDDSTypesTests.cpp @@ -37,8 +38,14 @@ set(DYNAMIC_TYPES_DDS_TYPES_TEST_SOURCE ${PROJECT_SOURCE_DIR}/test/dds-types-test/aliasesTypeObjectSupport.cxx ${PROJECT_SOURCE_DIR}/test/dds-types-test/annotationsPubSubTypes.cxx ${PROJECT_SOURCE_DIR}/test/dds-types-test/annotationsTypeObjectSupport.cxx + ${PROJECT_SOURCE_DIR}/test/dds-types-test/appendablePubSubTypes.cxx + ${PROJECT_SOURCE_DIR}/test/dds-types-test/appendableTypeObjectSupport.cxx ${PROJECT_SOURCE_DIR}/test/dds-types-test/arraysPubSubTypes.cxx ${PROJECT_SOURCE_DIR}/test/dds-types-test/arraysTypeObjectSupport.cxx + ${PROJECT_SOURCE_DIR}/test/dds-types-test/bitsetsPubSubTypes.cxx + ${PROJECT_SOURCE_DIR}/test/dds-types-test/bitsetsTypeObjectSupport.cxx + ${PROJECT_SOURCE_DIR}/test/dds-types-test/enumerationsPubSubTypes.cxx + ${PROJECT_SOURCE_DIR}/test/dds-types-test/enumerationsTypeObjectSupport.cxx ${PROJECT_SOURCE_DIR}/test/dds-types-test/helpers/basic_inner_typesPubSubTypes.cxx ${PROJECT_SOURCE_DIR}/test/dds-types-test/helpers/basic_inner_typesTypeObjectSupport.cxx ${PROJECT_SOURCE_DIR}/test/dds-types-test/inheritancePubSubTypes.cxx @@ -55,15 +62,9 @@ set(DYNAMIC_TYPES_DDS_TYPES_TEST_SOURCE ${PROJECT_SOURCE_DIR}/test/dds-types-test/structuresTypeObjectSupport.cxx ${PROJECT_SOURCE_DIR}/test/dds-types-test/unionsPubSubTypes.cxx ${PROJECT_SOURCE_DIR}/test/dds-types-test/unionsTypeObjectSupport.cxx - # ${PROJECT_SOURCE_DIR}/test/dds-types-test/appendablePubSubTypes.cxx - # ${PROJECT_SOURCE_DIR}/test/dds-types-test/appendableTypeObjectSupport.cxx - ${PROJECT_SOURCE_DIR}/test/dds-types-test/bitsetsPubSubTypes.cxx - ${PROJECT_SOURCE_DIR}/test/dds-types-test/bitsetsTypeObjectSupport.cxx # ${PROJECT_SOURCE_DIR}/test/dds-types-test/constantsPubSubTypes.cxx # ${PROJECT_SOURCE_DIR}/test/dds-types-test/constantsTypeObjectSupport.cxx # ${PROJECT_SOURCE_DIR}/test/dds-types-test/declarationsPubSubTypes.cxx - ${PROJECT_SOURCE_DIR}/test/dds-types-test/enumerationsPubSubTypes.cxx - ${PROJECT_SOURCE_DIR}/test/dds-types-test/enumerationsTypeObjectSupport.cxx # ${PROJECT_SOURCE_DIR}/test/dds-types-test/externalPubSubTypes.cxx # ${PROJECT_SOURCE_DIR}/test/dds-types-test/finalPubSubTypes.cxx # ${PROJECT_SOURCE_DIR}/test/dds-types-test/finalTypeObjectSupport.cxx diff --git a/test/feature/dynamic_types/DynamicTypesDDSTypesTest.hpp b/test/feature/dynamic_types/DynamicTypesDDSTypesTest.hpp index fe918f24244..9a0a51b2e9f 100644 --- a/test/feature/dynamic_types/DynamicTypesDDSTypesTest.hpp +++ b/test/feature/dynamic_types/DynamicTypesDDSTypesTest.hpp @@ -85,6 +85,7 @@ constexpr const char* var_bool_name = "var_boolean"; constexpr const char* var_byte_name = "var_octet"; constexpr const char* var_char_name = "var_char8"; constexpr const char* var_wchar_name = "var_char16"; +constexpr const char* var_union_name = "var_union"; class DynamicTypesDDSTypesTest : public ::testing::Test { diff --git a/test/feature/dynamic_types/dds_types_tests/DynamicTypesAppendableDDSTypesTests.cpp b/test/feature/dynamic_types/dds_types_tests/DynamicTypesAppendableDDSTypesTests.cpp new file mode 100644 index 00000000000..e78aeef7182 --- /dev/null +++ b/test/feature/dynamic_types/dds_types_tests/DynamicTypesAppendableDDSTypesTests.cpp @@ -0,0 +1,925 @@ +// Copyright 2024 Proyectos y Sistemas de Mantenimiento SL (eProsima). +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include + +#include "../DynamicTypesDDSTypesTest.hpp" +#include "../../../dds-types-test/helpers/basic_inner_types.hpp" +#include "../../../dds-types-test/appendablePubSubTypes.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace eprosima { +namespace fastdds { +namespace dds { + +constexpr const char* const appendable_short_struct_name = "AppendableShortStruct"; +constexpr const char* const appendable_ushort_struct_name = "AppendableUShortStruct"; +constexpr const char* const appendable_long_struct_name = "AppendableLongStruct"; +constexpr const char* const appendable_ulong_struct_name = "AppendableULongStruct"; +constexpr const char* const appendable_longlong_struct_name = "AppendableLongLongStruct"; +constexpr const char* const appendable_ulonglong_struct_name = "AppendableULongLongStruct"; +constexpr const char* const appendable_float_struct_name = "AppendableFloatStruct"; +constexpr const char* const appendable_double_struct_name = "AppendableDoubleStruct"; +constexpr const char* const appendable_longdouble_struct_name = "AppendableLongDoubleStruct"; +constexpr const char* const appendable_bool_struct_name = "AppendableBooleanStruct"; +constexpr const char* const appendable_byte_struct_name = "AppendableOctetStruct"; +constexpr const char* const appendable_char_struct_name = "AppendableCharStruct"; +constexpr const char* const appendable_wchar_struct_name = "AppendableWCharStruct"; +constexpr const char* const appendable_union_struct_name = "AppendableUnionStruct"; +constexpr const char* const appendable_empty_struct_name = "AppendableEmptyStruct"; +constexpr const char* const appendable_emptyinheritance_struct_name = "AppendableEmptyInheritanceStruct"; +constexpr const char* const appendable_inheritance_struct_name = "AppendableInheritanceStruct"; +constexpr const char* const appendable_inheritanceempty_struct_name = "AppendableInheritanceEmptyStruct"; +constexpr const char* const appendable_extensibilityinheritance_struct_name = "AppendableExtensibilityInheritance"; + +constexpr const char* var_str_name = "var_str"; + +DynamicType::_ref_type create_appendable_short_struct() +{ + TypeDescriptor::_ref_type type_descriptor {traits::make_shared()}; + type_descriptor->kind(TK_STRUCTURE); + type_descriptor->name(appendable_short_struct_name); + type_descriptor->extensibility_kind(ExtensibilityKind::APPENDABLE); + DynamicTypeBuilder::_ref_type type_builder {DynamicTypeBuilderFactory::get_instance()->create_type(type_descriptor)}; + + MemberDescriptor::_ref_type member_descriptor {traits::make_shared()}; + member_descriptor->name(var_short_name); + member_descriptor->type(DynamicTypeBuilderFactory::get_instance()->get_primitive_type(TK_INT16)); + type_builder->add_member(member_descriptor); + + return type_builder->build(); +} + +DynamicType::_ref_type create_appendable_empty_struct() +{ + TypeDescriptor::_ref_type type_descriptor {traits::make_shared()}; + type_descriptor->kind(TK_STRUCTURE); + type_descriptor->name(appendable_empty_struct_name); + type_descriptor->extensibility_kind(ExtensibilityKind::APPENDABLE); + DynamicTypeBuilder::_ref_type type_builder {DynamicTypeBuilderFactory::get_instance()->create_type(type_descriptor)}; + + return type_builder->build(); +} + +TEST_F(DynamicTypesDDSTypesTest, DDSTypesTest_AppendableShortStruct) +{ + DynamicType::_ref_type struct_type = create_appendable_short_struct(); + DynamicData::_ref_type data {DynamicDataFactory::get_instance()->create_data(struct_type)}; + ASSERT_TRUE(data); + + int16_t value = 2; + int16_t test_value = 0; + EXPECT_EQ(data->set_int16_value(data->get_member_id_by_name(var_short_name), value), RETCODE_OK); + EXPECT_EQ(data->get_int16_value(test_value, data->get_member_id_by_name(var_short_name)), RETCODE_OK); + EXPECT_EQ(value, test_value); + + // XCDRv1 + { + AppendableShortStruct struct_data; + AppendableShortStructPubSubType static_pubsubType; + check_serialization_deserialization(struct_type, data, XCDR_DATA_REPRESENTATION, struct_data, + static_pubsubType); + EXPECT_EQ(struct_data.var_short(), test_value); + } + + // XCDRv2 + { + AppendableShortStruct struct_data; + AppendableShortStructPubSubType static_pubsubType; + check_serialization_deserialization(struct_type, data, XCDR2_DATA_REPRESENTATION, struct_data, + static_pubsubType); + EXPECT_EQ(struct_data.var_short(), test_value); + } + + EXPECT_EQ(DynamicDataFactory::get_instance()->delete_data(data), RETCODE_OK); +} + +TEST_F(DynamicTypesDDSTypesTest, DDSTypesTest_AppendableUShortStruct) +{ + TypeDescriptor::_ref_type type_descriptor {traits::make_shared()}; + type_descriptor->kind(TK_STRUCTURE); + type_descriptor->name(appendable_ushort_struct_name); + type_descriptor->extensibility_kind(ExtensibilityKind::APPENDABLE); + DynamicTypeBuilder::_ref_type type_builder {DynamicTypeBuilderFactory::get_instance()->create_type(type_descriptor)}; + + MemberDescriptor::_ref_type member_descriptor {traits::make_shared()}; + member_descriptor->name(var_ushort_name); + member_descriptor->type(DynamicTypeBuilderFactory::get_instance()->get_primitive_type(TK_UINT16)); + type_builder->add_member(member_descriptor); + + DynamicType::_ref_type struct_type = type_builder->build(); + DynamicData::_ref_type data {DynamicDataFactory::get_instance()->create_data(struct_type)}; + ASSERT_TRUE(data); + + uint16_t value = 2; + uint16_t test_value = 0; + EXPECT_EQ(data->set_uint16_value(data->get_member_id_by_name(var_ushort_name), value), RETCODE_OK); + EXPECT_EQ(data->get_uint16_value(test_value, data->get_member_id_by_name(var_ushort_name)), RETCODE_OK); + EXPECT_EQ(value, test_value); + + // XCDRv1 + { + AppendableUShortStruct struct_data; + AppendableUShortStructPubSubType static_pubsubType; + check_serialization_deserialization(struct_type, data, XCDR_DATA_REPRESENTATION, struct_data, + static_pubsubType); + EXPECT_EQ(struct_data.var_ushort(), test_value); + } + + // XCDRv2 + { + AppendableUShortStruct struct_data; + AppendableUShortStructPubSubType static_pubsubType; + check_serialization_deserialization(struct_type, data, XCDR2_DATA_REPRESENTATION, struct_data, + static_pubsubType); + EXPECT_EQ(struct_data.var_ushort(), test_value); + } + + EXPECT_EQ(DynamicDataFactory::get_instance()->delete_data(data), RETCODE_OK); +} + +TEST_F(DynamicTypesDDSTypesTest, DDSTypesTest_AppendableLongStruct) +{ + TypeDescriptor::_ref_type type_descriptor {traits::make_shared()}; + type_descriptor->kind(TK_STRUCTURE); + type_descriptor->name(appendable_long_struct_name); + type_descriptor->extensibility_kind(ExtensibilityKind::APPENDABLE); + DynamicTypeBuilder::_ref_type type_builder {DynamicTypeBuilderFactory::get_instance()->create_type(type_descriptor)}; + + MemberDescriptor::_ref_type member_descriptor {traits::make_shared()}; + member_descriptor->name(var_long_name); + member_descriptor->type(DynamicTypeBuilderFactory::get_instance()->get_primitive_type(TK_INT32)); + type_builder->add_member(member_descriptor); + + DynamicType::_ref_type struct_type = type_builder->build(); + DynamicData::_ref_type data {DynamicDataFactory::get_instance()->create_data(struct_type)}; + ASSERT_TRUE(data); + + int32_t value = 2; + int32_t test_value = 0; + EXPECT_EQ(data->set_int32_value(data->get_member_id_by_name(var_long_name), value), RETCODE_OK); + EXPECT_EQ(data->get_int32_value(test_value, data->get_member_id_by_name(var_long_name)), RETCODE_OK); + EXPECT_EQ(value, test_value); + + // XCDRv1 + { + AppendableLongStruct struct_data; + AppendableLongStructPubSubType static_pubsubType; + check_serialization_deserialization(struct_type, data, XCDR_DATA_REPRESENTATION, struct_data, + static_pubsubType); + EXPECT_EQ(struct_data.var_long(), test_value); + } + + // XCDRv2 + { + AppendableLongStruct struct_data; + AppendableLongStructPubSubType static_pubsubType; + check_serialization_deserialization(struct_type, data, XCDR2_DATA_REPRESENTATION, struct_data, + static_pubsubType); + EXPECT_EQ(struct_data.var_long(), test_value); + } + + EXPECT_EQ(DynamicDataFactory::get_instance()->delete_data(data), RETCODE_OK); +} + +TEST_F(DynamicTypesDDSTypesTest, DDSTypesTest_AppendableULongStruct) +{ + TypeDescriptor::_ref_type type_descriptor {traits::make_shared()}; + type_descriptor->kind(TK_STRUCTURE); + type_descriptor->name(appendable_ulong_struct_name); + type_descriptor->extensibility_kind(ExtensibilityKind::APPENDABLE); + DynamicTypeBuilder::_ref_type type_builder {DynamicTypeBuilderFactory::get_instance()->create_type(type_descriptor)}; + + MemberDescriptor::_ref_type member_descriptor {traits::make_shared()}; + member_descriptor->name(var_ulong_name); + member_descriptor->type(DynamicTypeBuilderFactory::get_instance()->get_primitive_type(TK_UINT32)); + type_builder->add_member(member_descriptor); + + DynamicType::_ref_type struct_type = type_builder->build(); + DynamicData::_ref_type data {DynamicDataFactory::get_instance()->create_data(struct_type)}; + ASSERT_TRUE(data); + + uint32_t value = 2; + uint32_t test_value = 0; + EXPECT_EQ(data->set_uint32_value(data->get_member_id_by_name(var_ulong_name), value), RETCODE_OK); + EXPECT_EQ(data->get_uint32_value(test_value, data->get_member_id_by_name(var_ulong_name)), RETCODE_OK); + EXPECT_EQ(value, test_value); + + // XCDRv1 + { + AppendableULongStruct struct_data; + AppendableULongStructPubSubType static_pubsubType; + check_serialization_deserialization(struct_type, data, XCDR_DATA_REPRESENTATION, struct_data, + static_pubsubType); + EXPECT_EQ(struct_data.var_ulong(), test_value); + } + + // XCDRv2 + { + AppendableULongStruct struct_data; + AppendableULongStructPubSubType static_pubsubType; + check_serialization_deserialization(struct_type, data, XCDR2_DATA_REPRESENTATION, struct_data, + static_pubsubType); + EXPECT_EQ(struct_data.var_ulong(), test_value); + } + + EXPECT_EQ(DynamicDataFactory::get_instance()->delete_data(data), RETCODE_OK); +} + +TEST_F(DynamicTypesDDSTypesTest, DDSTypesTest_AppendableLongLongStruct) +{ + TypeDescriptor::_ref_type type_descriptor {traits::make_shared()}; + type_descriptor->kind(TK_STRUCTURE); + type_descriptor->name(appendable_longlong_struct_name); + type_descriptor->extensibility_kind(ExtensibilityKind::APPENDABLE); + DynamicTypeBuilder::_ref_type type_builder {DynamicTypeBuilderFactory::get_instance()->create_type(type_descriptor)}; + + MemberDescriptor::_ref_type member_descriptor {traits::make_shared()}; + member_descriptor->name(var_long_long_name); + member_descriptor->type(DynamicTypeBuilderFactory::get_instance()->get_primitive_type(TK_INT64)); + type_builder->add_member(member_descriptor); + + DynamicType::_ref_type struct_type = type_builder->build(); + DynamicData::_ref_type data {DynamicDataFactory::get_instance()->create_data(struct_type)}; + ASSERT_TRUE(data); + + int64_t value = 2; + int64_t test_value = 0; + EXPECT_EQ(data->set_int64_value(data->get_member_id_by_name(var_long_long_name), value), RETCODE_OK); + EXPECT_EQ(data->get_int64_value(test_value, data->get_member_id_by_name(var_long_long_name)), RETCODE_OK); + EXPECT_EQ(value, test_value); + + // XCDRv1 + { + AppendableLongLongStruct struct_data; + AppendableLongLongStructPubSubType static_pubsubType; + check_serialization_deserialization(struct_type, data, XCDR_DATA_REPRESENTATION, struct_data, + static_pubsubType); + EXPECT_EQ(struct_data.var_longlong(), test_value); + } + + // XCDRv2 + { + AppendableLongLongStruct struct_data; + AppendableLongLongStructPubSubType static_pubsubType; + check_serialization_deserialization(struct_type, data, XCDR2_DATA_REPRESENTATION, struct_data, + static_pubsubType); + EXPECT_EQ(struct_data.var_longlong(), test_value); + } + + EXPECT_EQ(DynamicDataFactory::get_instance()->delete_data(data), RETCODE_OK); +} + +TEST_F(DynamicTypesDDSTypesTest, DDSTypesTest_AppendableULongLongStruct) +{ + TypeDescriptor::_ref_type type_descriptor {traits::make_shared()}; + type_descriptor->kind(TK_STRUCTURE); + type_descriptor->name(appendable_ulonglong_struct_name); + type_descriptor->extensibility_kind(ExtensibilityKind::APPENDABLE); + DynamicTypeBuilder::_ref_type type_builder {DynamicTypeBuilderFactory::get_instance()->create_type(type_descriptor)}; + + MemberDescriptor::_ref_type member_descriptor {traits::make_shared()}; + member_descriptor->name(var_ulong_long_name); + member_descriptor->type(DynamicTypeBuilderFactory::get_instance()->get_primitive_type(TK_UINT64)); + type_builder->add_member(member_descriptor); + + DynamicType::_ref_type struct_type = type_builder->build(); + DynamicData::_ref_type data {DynamicDataFactory::get_instance()->create_data(struct_type)}; + ASSERT_TRUE(data); + + uint64_t value = 2; + uint64_t test_value = 0; + EXPECT_EQ(data->set_uint64_value(data->get_member_id_by_name(var_ulong_long_name), value), RETCODE_OK); + EXPECT_EQ(data->get_uint64_value(test_value, data->get_member_id_by_name(var_ulong_long_name)), RETCODE_OK); + EXPECT_EQ(value, test_value); + + // XCDRv1 + { + AppendableULongLongStruct struct_data; + AppendableULongLongStructPubSubType static_pubsubType; + check_serialization_deserialization(struct_type, data, XCDR_DATA_REPRESENTATION, struct_data, + static_pubsubType); + EXPECT_EQ(struct_data.var_ulonglong(), test_value); + } + + // XCDRv2 + { + AppendableULongLongStruct struct_data; + AppendableULongLongStructPubSubType static_pubsubType; + check_serialization_deserialization(struct_type, data, XCDR2_DATA_REPRESENTATION, struct_data, + static_pubsubType); + EXPECT_EQ(struct_data.var_ulonglong(), test_value); + } + + EXPECT_EQ(DynamicDataFactory::get_instance()->delete_data(data), RETCODE_OK); +} + +TEST_F(DynamicTypesDDSTypesTest, DDSTypesTest_AppendableFloatStruct) +{ + TypeDescriptor::_ref_type type_descriptor {traits::make_shared()}; + type_descriptor->kind(TK_STRUCTURE); + type_descriptor->name(appendable_float_struct_name); + type_descriptor->extensibility_kind(ExtensibilityKind::APPENDABLE); + DynamicTypeBuilder::_ref_type type_builder {DynamicTypeBuilderFactory::get_instance()->create_type(type_descriptor)}; + + MemberDescriptor::_ref_type member_descriptor {traits::make_shared()}; + member_descriptor->name(var_float_name); + member_descriptor->type(DynamicTypeBuilderFactory::get_instance()->get_primitive_type(TK_FLOAT32)); + type_builder->add_member(member_descriptor); + + DynamicType::_ref_type struct_type = type_builder->build(); + DynamicData::_ref_type data {DynamicDataFactory::get_instance()->create_data(struct_type)}; + ASSERT_TRUE(data); + + float value = 2; + float test_value = 0; + EXPECT_EQ(data->set_float32_value(data->get_member_id_by_name(var_float_name), value), RETCODE_OK); + EXPECT_EQ(data->get_float32_value(test_value, data->get_member_id_by_name(var_float_name)), RETCODE_OK); + EXPECT_EQ(value, test_value); + + // XCDRv1 + { + AppendableFloatStruct struct_data; + AppendableFloatStructPubSubType static_pubsubType; + check_serialization_deserialization(struct_type, data, XCDR_DATA_REPRESENTATION, struct_data, + static_pubsubType); + EXPECT_EQ(struct_data.var_float(), test_value); + } + + // XCDRv2 + { + AppendableFloatStruct struct_data; + AppendableFloatStructPubSubType static_pubsubType; + check_serialization_deserialization(struct_type, data, XCDR2_DATA_REPRESENTATION, struct_data, + static_pubsubType); + EXPECT_EQ(struct_data.var_float(), test_value); + } + + EXPECT_EQ(DynamicDataFactory::get_instance()->delete_data(data), RETCODE_OK); +} + +TEST_F(DynamicTypesDDSTypesTest, DDSTypesTest_AppendableDoubleStruct) +{ + TypeDescriptor::_ref_type type_descriptor {traits::make_shared()}; + type_descriptor->kind(TK_STRUCTURE); + type_descriptor->name(appendable_double_struct_name); + type_descriptor->extensibility_kind(ExtensibilityKind::APPENDABLE); + DynamicTypeBuilder::_ref_type type_builder {DynamicTypeBuilderFactory::get_instance()->create_type(type_descriptor)}; + + MemberDescriptor::_ref_type member_descriptor {traits::make_shared()}; + member_descriptor->name(var_double_name); + member_descriptor->type(DynamicTypeBuilderFactory::get_instance()->get_primitive_type(TK_FLOAT64)); + type_builder->add_member(member_descriptor); + + DynamicType::_ref_type struct_type = type_builder->build(); + DynamicData::_ref_type data {DynamicDataFactory::get_instance()->create_data(struct_type)}; + ASSERT_TRUE(data); + + double value = 2; + double test_value = 0; + EXPECT_EQ(data->set_float64_value(data->get_member_id_by_name(var_double_name), value), RETCODE_OK); + EXPECT_EQ(data->get_float64_value(test_value, data->get_member_id_by_name(var_double_name)), RETCODE_OK); + EXPECT_EQ(value, test_value); + + // XCDRv1 + { + AppendableDoubleStruct struct_data; + AppendableDoubleStructPubSubType static_pubsubType; + check_serialization_deserialization(struct_type, data, XCDR_DATA_REPRESENTATION, struct_data, + static_pubsubType); + EXPECT_EQ(struct_data.var_double(), test_value); + } + + // XCDRv2 + { + AppendableDoubleStruct struct_data; + AppendableDoubleStructPubSubType static_pubsubType; + check_serialization_deserialization(struct_type, data, XCDR2_DATA_REPRESENTATION, struct_data, + static_pubsubType); + EXPECT_EQ(struct_data.var_double(), test_value); + } + + EXPECT_EQ(DynamicDataFactory::get_instance()->delete_data(data), RETCODE_OK); +} + +TEST_F(DynamicTypesDDSTypesTest, DDSTypesTest_AppendableLongDoubleStruct) +{ + TypeDescriptor::_ref_type type_descriptor {traits::make_shared()}; + type_descriptor->kind(TK_STRUCTURE); + type_descriptor->name(appendable_longdouble_struct_name); + type_descriptor->extensibility_kind(ExtensibilityKind::APPENDABLE); + DynamicTypeBuilder::_ref_type type_builder {DynamicTypeBuilderFactory::get_instance()->create_type(type_descriptor)}; + + MemberDescriptor::_ref_type member_descriptor {traits::make_shared()}; + member_descriptor->name(var_long_double_name); + member_descriptor->type(DynamicTypeBuilderFactory::get_instance()->get_primitive_type(TK_FLOAT128)); + type_builder->add_member(member_descriptor); + + DynamicType::_ref_type struct_type = type_builder->build(); + DynamicData::_ref_type data {DynamicDataFactory::get_instance()->create_data(struct_type)}; + ASSERT_TRUE(data); + + long double value = 2; + long double test_value = 0; + EXPECT_EQ(data->set_float128_value(data->get_member_id_by_name(var_long_double_name), value), RETCODE_OK); + EXPECT_EQ(data->get_float128_value(test_value, data->get_member_id_by_name(var_long_double_name)), RETCODE_OK); + EXPECT_EQ(value, test_value); + + // XCDRv1 + { + AppendableLongDoubleStruct struct_data; + AppendableLongDoubleStructPubSubType static_pubsubType; + check_serialization_deserialization(struct_type, data, XCDR_DATA_REPRESENTATION, struct_data, + static_pubsubType); + EXPECT_EQ(struct_data.var_longdouble(), test_value); + } + + // XCDRv2 + { + AppendableLongDoubleStruct struct_data; + AppendableLongDoubleStructPubSubType static_pubsubType; + check_serialization_deserialization(struct_type, data, XCDR2_DATA_REPRESENTATION, struct_data, + static_pubsubType); + EXPECT_EQ(struct_data.var_longdouble(), test_value); + } + + EXPECT_EQ(DynamicDataFactory::get_instance()->delete_data(data), RETCODE_OK); +} + +TEST_F(DynamicTypesDDSTypesTest, DDSTypesTest_AppendableBooleanStruct) +{ + TypeDescriptor::_ref_type type_descriptor {traits::make_shared()}; + type_descriptor->kind(TK_STRUCTURE); + type_descriptor->name(appendable_bool_struct_name); + type_descriptor->extensibility_kind(ExtensibilityKind::APPENDABLE); + DynamicTypeBuilder::_ref_type type_builder {DynamicTypeBuilderFactory::get_instance()->create_type(type_descriptor)}; + + MemberDescriptor::_ref_type member_descriptor {traits::make_shared()}; + member_descriptor->name(var_bool_name); + member_descriptor->type(DynamicTypeBuilderFactory::get_instance()->get_primitive_type(TK_BOOLEAN)); + type_builder->add_member(member_descriptor); + + DynamicType::_ref_type struct_type = type_builder->build(); + DynamicData::_ref_type data {DynamicDataFactory::get_instance()->create_data(struct_type)}; + ASSERT_TRUE(data); + + bool value = true; + bool test_value = false; + EXPECT_EQ(data->set_boolean_value(data->get_member_id_by_name(var_bool_name), value), RETCODE_OK); + EXPECT_EQ(data->get_boolean_value(test_value, data->get_member_id_by_name(var_bool_name)), RETCODE_OK); + EXPECT_EQ(value, test_value); + + // XCDRv1 + { + AppendableBooleanStruct struct_data; + AppendableBooleanStructPubSubType static_pubsubType; + check_serialization_deserialization(struct_type, data, XCDR_DATA_REPRESENTATION, struct_data, + static_pubsubType); + EXPECT_EQ(struct_data.var_boolean(), test_value); + } + + // XCDRv2 + { + AppendableBooleanStruct struct_data; + AppendableBooleanStructPubSubType static_pubsubType; + check_serialization_deserialization(struct_type, data, XCDR2_DATA_REPRESENTATION, struct_data, + static_pubsubType); + EXPECT_EQ(struct_data.var_boolean(), test_value); + } + + EXPECT_EQ(DynamicDataFactory::get_instance()->delete_data(data), RETCODE_OK); +} + +TEST_F(DynamicTypesDDSTypesTest, DDSTypesTest_AppendableOctetStruct) +{ + TypeDescriptor::_ref_type type_descriptor {traits::make_shared()}; + type_descriptor->kind(TK_STRUCTURE); + type_descriptor->name(appendable_byte_struct_name); + type_descriptor->extensibility_kind(ExtensibilityKind::APPENDABLE); + DynamicTypeBuilder::_ref_type type_builder {DynamicTypeBuilderFactory::get_instance()->create_type(type_descriptor)}; + + MemberDescriptor::_ref_type member_descriptor {traits::make_shared()}; + member_descriptor->name(var_byte_name); + member_descriptor->type(DynamicTypeBuilderFactory::get_instance()->get_primitive_type(TK_BYTE)); + type_builder->add_member(member_descriptor); + + DynamicType::_ref_type struct_type = type_builder->build(); + DynamicData::_ref_type data {DynamicDataFactory::get_instance()->create_data(struct_type)}; + ASSERT_TRUE(data); + + eprosima::fastrtps::rtps::octet value = 255; + eprosima::fastrtps::rtps::octet test_value = 0; + EXPECT_EQ(data->set_byte_value(data->get_member_id_by_name(var_byte_name), value), RETCODE_OK); + EXPECT_EQ(data->get_byte_value(test_value, data->get_member_id_by_name(var_byte_name)), RETCODE_OK); + EXPECT_EQ(value, test_value); + + // XCDRv1 + { + AppendableOctetStruct struct_data; + AppendableOctetStructPubSubType static_pubsubType; + check_serialization_deserialization(struct_type, data, XCDR_DATA_REPRESENTATION, struct_data, + static_pubsubType); + EXPECT_EQ(struct_data.var_octet(), test_value); + } + + // XCDRv2 + { + AppendableOctetStruct struct_data; + AppendableOctetStructPubSubType static_pubsubType; + check_serialization_deserialization(struct_type, data, XCDR2_DATA_REPRESENTATION, struct_data, + static_pubsubType); + EXPECT_EQ(struct_data.var_octet(), test_value); + } + + EXPECT_EQ(DynamicDataFactory::get_instance()->delete_data(data), RETCODE_OK); +} + +TEST_F(DynamicTypesDDSTypesTest, DDSTypesTest_AppendableCharStruct) +{ + TypeDescriptor::_ref_type type_descriptor {traits::make_shared()}; + type_descriptor->kind(TK_STRUCTURE); + type_descriptor->name(appendable_char_struct_name); + type_descriptor->extensibility_kind(ExtensibilityKind::APPENDABLE); + DynamicTypeBuilder::_ref_type type_builder {DynamicTypeBuilderFactory::get_instance()->create_type(type_descriptor)}; + + MemberDescriptor::_ref_type member_descriptor {traits::make_shared()}; + member_descriptor->name(var_char_name); + member_descriptor->type(DynamicTypeBuilderFactory::get_instance()->get_primitive_type(TK_CHAR8)); + type_builder->add_member(member_descriptor); + + DynamicType::_ref_type struct_type = type_builder->build(); + DynamicData::_ref_type data {DynamicDataFactory::get_instance()->create_data(struct_type)}; + ASSERT_TRUE(data); + + char value = 'a'; + char test_value = 'b'; + EXPECT_EQ(data->set_char8_value(data->get_member_id_by_name(var_char_name), value), RETCODE_OK); + EXPECT_EQ(data->get_char8_value(test_value, data->get_member_id_by_name(var_char_name)), RETCODE_OK); + EXPECT_EQ(value, test_value); + + // XCDRv1 + { + AppendableCharStruct struct_data; + AppendableCharStructPubSubType static_pubsubType; + check_serialization_deserialization(struct_type, data, XCDR_DATA_REPRESENTATION, struct_data, + static_pubsubType); + EXPECT_EQ(struct_data.var_char8(), test_value); + } + + // XCDRv2 + { + AppendableCharStruct struct_data; + AppendableCharStructPubSubType static_pubsubType; + check_serialization_deserialization(struct_type, data, XCDR2_DATA_REPRESENTATION, struct_data, + static_pubsubType); + EXPECT_EQ(struct_data.var_char8(), test_value); + } + + EXPECT_EQ(DynamicDataFactory::get_instance()->delete_data(data), RETCODE_OK); +} + +TEST_F(DynamicTypesDDSTypesTest, DDSTypesTest_AppendableWCharStruct) +{ + TypeDescriptor::_ref_type type_descriptor {traits::make_shared()}; + type_descriptor->kind(TK_STRUCTURE); + type_descriptor->name(appendable_wchar_struct_name); + type_descriptor->extensibility_kind(ExtensibilityKind::APPENDABLE); + DynamicTypeBuilder::_ref_type type_builder {DynamicTypeBuilderFactory::get_instance()->create_type(type_descriptor)}; + + MemberDescriptor::_ref_type member_descriptor {traits::make_shared()}; + member_descriptor->name(var_wchar_name); + member_descriptor->type(DynamicTypeBuilderFactory::get_instance()->get_primitive_type(TK_CHAR16)); + type_builder->add_member(member_descriptor); + + DynamicType::_ref_type struct_type = type_builder->build(); + DynamicData::_ref_type data {DynamicDataFactory::get_instance()->create_data(struct_type)}; + ASSERT_TRUE(data); + + wchar_t value = L'a'; + wchar_t test_value = L'b'; + EXPECT_EQ(data->set_char16_value(data->get_member_id_by_name(var_wchar_name), value), RETCODE_OK); + EXPECT_EQ(data->get_char16_value(test_value, data->get_member_id_by_name(var_wchar_name)), RETCODE_OK); + EXPECT_EQ(value, test_value); + + // XCDRv1 + { + AppendableWCharStruct struct_data; + AppendableWCharStructPubSubType static_pubsubType; + check_serialization_deserialization(struct_type, data, XCDR_DATA_REPRESENTATION, struct_data, + static_pubsubType); + EXPECT_EQ(struct_data.var_char16(), test_value); + } + + // XCDRv2 + { + AppendableWCharStruct struct_data; + AppendableWCharStructPubSubType static_pubsubType; + check_serialization_deserialization(struct_type, data, XCDR2_DATA_REPRESENTATION, struct_data, + static_pubsubType); + EXPECT_EQ(struct_data.var_char16(), test_value); + } + + EXPECT_EQ(DynamicDataFactory::get_instance()->delete_data(data), RETCODE_OK); +} + +TEST_F(DynamicTypesDDSTypesTest, DDSTypesTest_AppendableUnionStruct) +{ + TypeDescriptor::_ref_type type_descriptor {traits::make_shared()}; + type_descriptor->kind(TK_STRUCTURE); + type_descriptor->name(appendable_union_struct_name); + type_descriptor->extensibility_kind(ExtensibilityKind::APPENDABLE); + DynamicTypeBuilder::_ref_type type_builder {DynamicTypeBuilderFactory::get_instance()->create_type(type_descriptor)}; + + MemberDescriptor::_ref_type member_descriptor {traits::make_shared()}; + member_descriptor->name(var_union_name); + member_descriptor->type(DynamicTypesDDSTypesTest::create_inner_union_helper()); + type_builder->add_member(member_descriptor); + + DynamicType::_ref_type struct_type = type_builder->build(); + DynamicData::_ref_type data {DynamicDataFactory::get_instance()->create_data(struct_type)}; + ASSERT_TRUE(data); + + float float_value = 23.5; + float test_float_value = 0; + int16_t short_value = 55; + int16_t test_short_value = 0; + DynamicData::_ref_type union_data = data->loan_value(data->get_member_id_by_name(var_union_name)); + ASSERT_TRUE(union_data); + + EXPECT_EQ(union_data->set_float32_value(union_data->get_member_id_by_name( + union_float_member_name), float_value), RETCODE_OK); + EXPECT_EQ(union_data->get_float32_value(test_float_value, union_data->get_member_id_by_name( + union_float_member_name)), RETCODE_OK); + EXPECT_EQ(float_value, test_float_value); + EXPECT_EQ(union_data->set_int16_value(union_data->get_member_id_by_name( + union_short_member_name), short_value), RETCODE_OK); + EXPECT_EQ(union_data->get_int16_value(test_short_value, union_data->get_member_id_by_name( + union_short_member_name)), RETCODE_OK); + EXPECT_EQ(short_value, test_short_value); + EXPECT_EQ(data->return_loaned_value(union_data), RETCODE_OK); + + // XCDRv1 + { + AppendableUnionStruct struct_data; + AppendableUnionStructPubSubType static_pubsubType; + check_serialization_deserialization(struct_type, data, XCDR_DATA_REPRESENTATION, struct_data, + static_pubsubType); + EXPECT_EQ(struct_data.var_union().shortValue(), test_short_value); + } + + // XCDRv2 + { + AppendableUnionStruct struct_data; + AppendableUnionStructPubSubType static_pubsubType; + check_serialization_deserialization(struct_type, data, XCDR2_DATA_REPRESENTATION, struct_data, + static_pubsubType); + EXPECT_EQ(struct_data.var_union().shortValue(), test_short_value); + } + + EXPECT_EQ(DynamicDataFactory::get_instance()->delete_data(data), RETCODE_OK); +} + +TEST_F(DynamicTypesDDSTypesTest, DDSTypesTest_AppendableEmptyStruct) +{ + TypeDescriptor::_ref_type type_descriptor {traits::make_shared()}; + type_descriptor->kind(TK_STRUCTURE); + type_descriptor->name(appendable_empty_struct_name); + type_descriptor->extensibility_kind(ExtensibilityKind::APPENDABLE); + DynamicTypeBuilder::_ref_type type_builder {DynamicTypeBuilderFactory::get_instance()->create_type(type_descriptor)}; + + DynamicType::_ref_type struct_type = type_builder->build(); + DynamicData::_ref_type data {DynamicDataFactory::get_instance()->create_data(struct_type)}; + ASSERT_TRUE(data); + + // XCDRv1 + { + AppendableEmptyStruct struct_data; + AppendableEmptyStructPubSubType static_pubsubType; + check_serialization_deserialization(struct_type, data, XCDR_DATA_REPRESENTATION, struct_data, + static_pubsubType); + } + + // XCDRv2 + { + AppendableEmptyStruct struct_data; + AppendableEmptyStructPubSubType static_pubsubType; + check_serialization_deserialization(struct_type, data, XCDR2_DATA_REPRESENTATION, struct_data, + static_pubsubType); + } + + EXPECT_EQ(DynamicDataFactory::get_instance()->delete_data(data), RETCODE_OK); +} + +TEST_F(DynamicTypesDDSTypesTest, DDSTypesTest_AppendableEmptyInheritanceStruct) +{ + TypeDescriptor::_ref_type type_descriptor {traits::make_shared()}; + type_descriptor->kind(TK_STRUCTURE); + type_descriptor->name(appendable_emptyinheritance_struct_name); + type_descriptor->extensibility_kind(ExtensibilityKind::APPENDABLE); + type_descriptor->base_type(create_appendable_empty_struct()); + DynamicTypeBuilder::_ref_type type_builder {DynamicTypeBuilderFactory::get_instance()->create_type(type_descriptor)}; + + MemberDescriptor::_ref_type member_descriptor {traits::make_shared()}; + member_descriptor->name(var_str_name); + member_descriptor->type(DynamicTypeBuilderFactory::get_instance()->create_string_type(LENGTH_UNLIMITED)->build()); + type_builder->add_member(member_descriptor); + + DynamicType::_ref_type struct_type = type_builder->build(); + DynamicData::_ref_type data {DynamicDataFactory::get_instance()->create_data(struct_type)}; + ASSERT_TRUE(data); + + std::string str_value = "STRING_TEST"; + std::string str_test_value = ""; + EXPECT_EQ(data->set_string_value(data->get_member_id_by_name(var_str_name), str_value), RETCODE_OK); + EXPECT_EQ(data->get_string_value(str_test_value, data->get_member_id_by_name(var_str_name)), RETCODE_OK); + EXPECT_EQ(str_value, str_test_value); + + // XCDRv1 + { + AppendableEmptyInheritanceStruct struct_data; + AppendableEmptyInheritanceStructPubSubType static_pubsubType; + check_serialization_deserialization(struct_type, data, XCDR_DATA_REPRESENTATION, struct_data, + static_pubsubType); + EXPECT_EQ(struct_data.var_str(), str_test_value); + } + + // XCDRv2 + { + AppendableEmptyInheritanceStruct struct_data; + AppendableEmptyInheritanceStructPubSubType static_pubsubType; + check_serialization_deserialization(struct_type, data, XCDR2_DATA_REPRESENTATION, struct_data, + static_pubsubType); + EXPECT_EQ(struct_data.var_str(), str_test_value); + } + + EXPECT_EQ(DynamicDataFactory::get_instance()->delete_data(data), RETCODE_OK); +} + +TEST_F(DynamicTypesDDSTypesTest, DDSTypesTest_AppendableInheritanceStruct) +{ + TypeDescriptor::_ref_type type_descriptor {traits::make_shared()}; + type_descriptor->kind(TK_STRUCTURE); + type_descriptor->name(appendable_emptyinheritance_struct_name); + type_descriptor->extensibility_kind(ExtensibilityKind::APPENDABLE); + type_descriptor->base_type(create_appendable_short_struct()); + DynamicTypeBuilder::_ref_type type_builder {DynamicTypeBuilderFactory::get_instance()->create_type(type_descriptor)}; + + MemberDescriptor::_ref_type member_descriptor {traits::make_shared()}; + member_descriptor->name(var_str_name); + member_descriptor->type(DynamicTypeBuilderFactory::get_instance()->create_string_type(LENGTH_UNLIMITED)->build()); + type_builder->add_member(member_descriptor); + + DynamicType::_ref_type struct_type = type_builder->build(); + DynamicData::_ref_type data {DynamicDataFactory::get_instance()->create_data(struct_type)}; + ASSERT_TRUE(data); + + int16_t short_value = 2; + int16_t short_test_value = 0; + std::string str_value = "STRING_TEST"; + std::string str_test_value = ""; + EXPECT_EQ(data->set_int16_value(data->get_member_id_by_name(var_short_name), short_value), RETCODE_OK); + EXPECT_EQ(data->get_int16_value(short_test_value, data->get_member_id_by_name(var_short_name)), RETCODE_OK); + EXPECT_EQ(short_value, short_test_value); + + EXPECT_EQ(data->set_string_value(data->get_member_id_by_name(var_str_name), str_value), RETCODE_OK); + EXPECT_EQ(data->get_string_value(str_test_value, data->get_member_id_by_name(var_str_name)), RETCODE_OK); + EXPECT_EQ(str_value, str_test_value); + + // XCDRv1 + { + AppendableInheritanceStruct struct_data; + AppendableInheritanceStructPubSubType static_pubsubType; + check_serialization_deserialization(struct_type, data, XCDR_DATA_REPRESENTATION, struct_data, + static_pubsubType); + EXPECT_EQ(struct_data.var_short(), short_test_value); + EXPECT_EQ(struct_data.var_str(), str_test_value); + } + + // XCDRv2 + { + AppendableInheritanceStruct struct_data; + AppendableInheritanceStructPubSubType static_pubsubType; + check_serialization_deserialization(struct_type, data, XCDR2_DATA_REPRESENTATION, struct_data, + static_pubsubType); + EXPECT_EQ(struct_data.var_short(), short_test_value); + EXPECT_EQ(struct_data.var_str(), str_test_value); + } + + EXPECT_EQ(DynamicDataFactory::get_instance()->delete_data(data), RETCODE_OK); +} + +TEST_F(DynamicTypesDDSTypesTest, DDSTypesTest_AppendableInheritanceEmptyStruct) +{ + TypeDescriptor::_ref_type type_descriptor {traits::make_shared()}; + type_descriptor->kind(TK_STRUCTURE); + type_descriptor->name(appendable_inheritanceempty_struct_name); + type_descriptor->extensibility_kind(ExtensibilityKind::APPENDABLE); + type_descriptor->base_type(create_appendable_short_struct()); + DynamicTypeBuilder::_ref_type type_builder {DynamicTypeBuilderFactory::get_instance()->create_type(type_descriptor)}; + + DynamicType::_ref_type struct_type = type_builder->build(); + DynamicData::_ref_type data {DynamicDataFactory::get_instance()->create_data(struct_type)}; + ASSERT_TRUE(data); + + int16_t short_value = 2; + int16_t short_test_value = 0; + EXPECT_EQ(data->set_int16_value(data->get_member_id_by_name(var_short_name), short_value), RETCODE_OK); + EXPECT_EQ(data->get_int16_value(short_test_value, data->get_member_id_by_name(var_short_name)), RETCODE_OK); + EXPECT_EQ(short_value, short_test_value); + + // XCDRv1 + { + AppendableInheritanceEmptyStruct struct_data; + AppendableInheritanceEmptyStructPubSubType static_pubsubType; + check_serialization_deserialization(struct_type, data, XCDR_DATA_REPRESENTATION, struct_data, + static_pubsubType); + EXPECT_EQ(struct_data.var_short(), short_test_value); + } + + // XCDRv2 + { + AppendableInheritanceEmptyStruct struct_data; + AppendableInheritanceEmptyStructPubSubType static_pubsubType; + check_serialization_deserialization(struct_type, data, XCDR2_DATA_REPRESENTATION, struct_data, + static_pubsubType); + EXPECT_EQ(struct_data.var_short(), short_test_value); + } + + EXPECT_EQ(DynamicDataFactory::get_instance()->delete_data(data), RETCODE_OK); +} + +TEST_F(DynamicTypesDDSTypesTest, DDSTypesTest_AppendableExtensibilityInheritance) +{ + TypeDescriptor::_ref_type type_descriptor {traits::make_shared()}; + type_descriptor->kind(TK_STRUCTURE); + type_descriptor->name(appendable_extensibilityinheritance_struct_name); + type_descriptor->base_type(create_appendable_short_struct()); + DynamicTypeBuilder::_ref_type type_builder {DynamicTypeBuilderFactory::get_instance()->create_type(type_descriptor)}; + + MemberDescriptor::_ref_type member_descriptor {traits::make_shared()}; + member_descriptor->name(var_long_name); + member_descriptor->type(DynamicTypeBuilderFactory::get_instance()->get_primitive_type(TK_INT32)); + type_builder->add_member(member_descriptor); + + DynamicType::_ref_type struct_type = type_builder->build(); + DynamicData::_ref_type data {DynamicDataFactory::get_instance()->create_data(struct_type)}; + ASSERT_TRUE(data); + + int16_t short_value = 2; + int16_t short_test_value = 0; + int32_t long_value = 443; + int32_t long_test_value = 0; + + EXPECT_EQ(data->set_int16_value(data->get_member_id_by_name(var_short_name), short_value), RETCODE_OK); + EXPECT_EQ(data->get_int16_value(short_test_value, data->get_member_id_by_name(var_short_name)), RETCODE_OK); + EXPECT_EQ(short_value, short_test_value); + + EXPECT_EQ(data->set_int32_value(data->get_member_id_by_name(var_long_name), long_value), RETCODE_OK); + EXPECT_EQ(data->get_int32_value(long_test_value, data->get_member_id_by_name(var_long_name)), RETCODE_OK); + EXPECT_EQ(long_value, long_test_value); + + // XCDRv1 + { + AppendableExtensibilityInheritance struct_data; + AppendableExtensibilityInheritancePubSubType static_pubsubType; + check_serialization_deserialization(struct_type, data, XCDR_DATA_REPRESENTATION, struct_data, + static_pubsubType); + EXPECT_EQ(struct_data.var_short(), short_test_value); + EXPECT_EQ(struct_data.var_long(), long_test_value); + } + + // XCDRv2 + { + AppendableExtensibilityInheritance struct_data; + AppendableExtensibilityInheritancePubSubType static_pubsubType; + check_serialization_deserialization(struct_type, data, XCDR2_DATA_REPRESENTATION, struct_data, + static_pubsubType); + EXPECT_EQ(struct_data.var_short(), short_test_value); + EXPECT_EQ(struct_data.var_long(), long_test_value); + } + + EXPECT_EQ(DynamicDataFactory::get_instance()->delete_data(data), RETCODE_OK); +} + +} // namespace dds +} // namespace fastdds +} // namespace eprosima diff --git a/test/feature/dynamic_types/dds_types_tests/DynamicTypesStructuresDDSTypesTests.cpp b/test/feature/dynamic_types/dds_types_tests/DynamicTypesStructuresDDSTypesTests.cpp index e51a3188714..6abe3b731e5 100644 --- a/test/feature/dynamic_types/dds_types_tests/DynamicTypesStructuresDDSTypesTests.cpp +++ b/test/feature/dynamic_types/dds_types_tests/DynamicTypesStructuresDDSTypesTests.cpp @@ -69,7 +69,6 @@ constexpr const char* var_alias_name = "var_alias"; constexpr const char* var_array_name = "var_array_short"; constexpr const char* var_seq_name = "var_sequence"; constexpr const char* var_map_name = "var_map"; -constexpr const char* var_union_name = "var_union"; constexpr const char* var_struct_name = "var_structure"; constexpr const char* var_bitset_name = "var_bitset";