From 0cfed858be6792a28e6a4f824513003c2cae66be Mon Sep 17 00:00:00 2001 From: Adrian del Campo <107918259+adriancampo@users.noreply.github.com> Date: Mon, 11 Mar 2024 08:02:15 +0100 Subject: [PATCH] Fixes for indirect hashes dependencies. (#4496) * Refs #20572: Fixes for indirect hashes dependencies. Signed-off-by: adriancampo * Refs #20572: Applied suggestion. Added tests for build_plain_map_s_type_defn_inconsistencies. Signed-off-by: adriancampo * Refs #20572: Fixes for plain_map_type_identifier_header_consistency. Signed-off-by: adriancampo * Refs #20572: Changed get_type_dependencies methods and aliases equiv_kind as map components. Signed-off-by: adriancampo * Refs #20572: Applied suggestions. Signed-off-by: adriancampo * Refs #20572: Combined map consistency methods. Signed-off-by: adriancampo * Refs #20572: Removed redundant check. Signed-off-by: adriancampo --------- Signed-off-by: adriancampo --- .../type_representation/TypeObjectUtils.hpp | 27 + .../TypeObjectRegistry.cpp | 67 +- .../TypeObjectRegistry.hpp | 145 +++- .../type_representation/TypeObjectUtils.cpp | 145 +++- .../TypeObjectUtilsTests.cpp | 813 ++++++++++++++++-- 5 files changed, 1107 insertions(+), 90 deletions(-) diff --git a/include/fastdds/dds/xtypes/type_representation/TypeObjectUtils.hpp b/include/fastdds/dds/xtypes/type_representation/TypeObjectUtils.hpp index 11ecaf52eeb..71e70bbd94b 100644 --- a/include/fastdds/dds/xtypes/type_representation/TypeObjectUtils.hpp +++ b/include/fastdds/dds/xtypes/type_representation/TypeObjectUtils.hpp @@ -2121,6 +2121,33 @@ class TypeObjectUtils const PlainCollectionHeader& header, const TypeIdentifier& element_identifier); + /** + * @brief Retrieves the equivalence kind of a component within a map. + * + * @param[in] identifier TypeIdentifier of the component to be checked. + * @return EK_COMPLETE if the component equivalence kind is EK_COMPLETE. + * @return EK_MINIMAL if the component equivalence kind is EK_MINIMAL. + * @return EK_BOTH if the component equivalence kind is EK_BOTH. + * @return TK_NONE if the component type is invalid. + */ + static EquivalenceKind get_map_component_equiv_kind_for_consistency( + const TypeIdentifier& identifier); + + /** + * @brief Check consistency between a given PlainCollectionHeader of a map and the related TypeIdentifier: + * 1. Key TypeIdentifier is valid + * 2. TypeIdentifier initialized + * 3. Consistency of EquivalenceKinds + * + * @param[in] header PlainCollectionHeader of the map to be checked. + * @param[in] type_identifier TypeIdentifier to be checked. + * @exception eprosima::fastdds::dds::xtypes::InvalidArgumentError exception if the given parameters are not + * consistent. + */ + static void plain_map_type_components_consistency( + const PlainCollectionHeader& header, + const TypeIdentifier& type_identifier); + /** * @brief Check map key_identifier consistency. * XTypes v1.3 Clause 7.2.2.4.3: Implementers of this specification need only support key elements of signed diff --git a/src/cpp/fastdds/xtypes/type_representation/TypeObjectRegistry.cpp b/src/cpp/fastdds/xtypes/type_representation/TypeObjectRegistry.cpp index 5dd160754fa..63ad2e18d4b 100644 --- a/src/cpp/fastdds/xtypes/type_representation/TypeObjectRegistry.cpp +++ b/src/cpp/fastdds/xtypes/type_representation/TypeObjectRegistry.cpp @@ -342,25 +342,14 @@ ReturnCode_t TypeObjectRegistry::get_type_dependencies( const TypeIdentifierSeq& type_identifiers, std::unordered_set& type_dependencies) { - ReturnCode_t ret_code = eprosima::fastdds::dds::RETCODE_OK; for (const TypeIdentifier& type_id : type_identifiers) { if (!TypeObjectUtils::is_direct_hash_type_identifier(type_id)) { return eprosima::fastdds::dds::RETCODE_BAD_PARAMETER; } - TypeObject type_object; - ret_code = get_type_object(type_id, type_object); - if (eprosima::fastdds::dds::RETCODE_OK == ret_code) - { - ret_code = get_dependencies_from_type_object(type_object, type_dependencies); - if (eprosima::fastdds::dds::RETCODE_OK != ret_code) - { - break; - } - } } - return ret_code; + return get_type_dependencies_impl(type_identifiers, type_dependencies); } bool TypeObjectRegistry::is_type_identifier_known( @@ -560,6 +549,60 @@ ReturnCode_t TypeObjectRegistry::get_dependencies_from_type_object( return ret_code; } +ReturnCode_t TypeObjectRegistry::get_type_dependencies_impl( + const TypeIdentifierSeq& type_identifiers, + std::unordered_set& type_dependencies) +{ + ReturnCode_t ret_code = eprosima::fastdds::dds::RETCODE_OK; + for (const TypeIdentifier& type_id : type_identifiers) + { + if (TypeObjectUtils::is_fully_descriptive_type_identifier(type_id)) + { + return eprosima::fastdds::dds::RETCODE_BAD_PARAMETER; + } + else if (TypeObjectUtils::is_direct_hash_type_identifier(type_id)) + { + TypeObject type_object; + ret_code = get_type_object(type_id, type_object); + if (eprosima::fastdds::dds::RETCODE_OK == ret_code) + { + ret_code = get_dependencies_from_type_object(type_object, type_dependencies); + if (eprosima::fastdds::dds::RETCODE_OK != ret_code) + { + break; + } + } + } + else if (TypeObjectUtils::is_indirect_hash_type_identifier(type_id)) + { + switch (type_id._d()) + { + case TI_PLAIN_SEQUENCE_SMALL: + get_indirect_hash_collection_dependencies(type_id.seq_sdefn(), type_dependencies); + break; + case TI_PLAIN_SEQUENCE_LARGE: + get_indirect_hash_collection_dependencies(type_id.seq_ldefn(), type_dependencies); + break; + case TI_PLAIN_ARRAY_SMALL: + get_indirect_hash_collection_dependencies(type_id.array_sdefn(), type_dependencies); + break; + case TI_PLAIN_ARRAY_LARGE: + get_indirect_hash_collection_dependencies(type_id.array_ldefn(), type_dependencies); + break; + case TI_PLAIN_MAP_SMALL: + get_indirect_hash_map_dependencies(type_id.map_sdefn(), type_dependencies); + break; + case TI_PLAIN_MAP_LARGE: + get_indirect_hash_map_dependencies(type_id.map_ldefn(), type_dependencies); + break; + default: + return eprosima::fastdds::dds::RETCODE_BAD_PARAMETER; + } + } + } + return ret_code; +} + void TypeObjectRegistry::add_dependency( const TypeIdentifier& type_id, std::unordered_set& type_dependencies) diff --git a/src/cpp/fastdds/xtypes/type_representation/TypeObjectRegistry.hpp b/src/cpp/fastdds/xtypes/type_representation/TypeObjectRegistry.hpp index 6614649be38..3df8310926f 100644 --- a/src/cpp/fastdds/xtypes/type_representation/TypeObjectRegistry.hpp +++ b/src/cpp/fastdds/xtypes/type_representation/TypeObjectRegistry.hpp @@ -182,9 +182,9 @@ class TypeObjectRegistry : public ITypeObjectRegistry TypeInformation& type_information); /** - * @brief Get the type dependencies of the given type identifiers. + * @brief Get the type dependencies of the given direct hash type identifiers. * - * @param[in] type_identifiers Sequence with the queried TypeIdentifiers. + * @param[in] type_identifiers Sequence with the queried direct hash TypeIdentifiers. * @param[in out] type_dependencies Unordered set of TypeIdentifiers with related TypeObject serialized size. * @return ReturnCode_t RETCODE_OK if the operation is successful. * RETCODE_NO_DATA if any given TypeIdentifier is unknown to the registry. @@ -275,6 +275,19 @@ class TypeObjectRegistry : public ITypeObjectRegistry protected: + /** + * @brief Get the type dependencies of the given type identifiers. + * + * @param[in] type_identifiers Sequence with the queried TypeIdentifiers. + * @param[in out] type_dependencies Unordered set of TypeIdentifiers with related TypeObject serialized size. + * @return ReturnCode_t RETCODE_OK if the operation is successful. + * RETCODE_NO_DATA if any given TypeIdentifier is unknown to the registry. + * RETCODE_BAD_PARAMETER if any given TypeIdentifier is fully descriptive. + */ + ReturnCode_t get_type_dependencies_impl( + const TypeIdentifierSeq& type_identifiers, + std::unordered_set& type_dependencies); + /** * @brief Add type dependency to the sequence. * @@ -285,6 +298,82 @@ class TypeObjectRegistry : public ITypeObjectRegistry const TypeIdentifier& type_id, std::unordered_set& type_dependencies); + /** + * @brief Get the type dependencies of plain sequences or arrays. + * + * @tparam T Either PlainSequenceSElemDefn, PlainSequenceLElemDefn, PlainArraySElemDefn or PlainArrayLElemDefn. + * @param[in] collection_type Plain collection Type. + * @param[in out] type_dependencies Unordered set of TypeIdentifiers with related TypeObject serialized size. + * @return ReturnCode_t RETCODE_OK if the operation is successful. + * RETCODE_NO_DATA if any dependent TypeIdentifier is unknown to the registry. + * RETCODE_BAD_PARAMETER if the collection type is fully descriptive. + */ + template + ReturnCode_t get_indirect_hash_collection_dependencies( + const T& collection_type, + std::unordered_set& type_dependencies) + { + TypeIdentifierSeq type_ids; + + TypeIdentifier type_id = *collection_type.element_identifier(); + if (TypeObjectUtils::is_direct_hash_type_identifier(type_id)) + { + add_dependency(type_id, type_dependencies); + type_ids.push_back(type_id); + } + else if (TypeObjectUtils::is_indirect_hash_type_identifier(type_id)) + { + type_ids.push_back(type_id); + } + + if (!type_ids.empty()) + { + return get_type_dependencies_impl(type_ids, type_dependencies); + } + return eprosima::fastdds::dds::RETCODE_BAD_PARAMETER; + } + + /** + * @brief Get the type dependencies of plain maps. + * + * @tparam T Either PlainMapSTypeDefn or PlainMapLTypeDefn. + * @param[in] map_type Plain map Type. + * @param[in out] type_dependencies Unordered set of TypeIdentifiers with related TypeObject serialized size. + * @return ReturnCode_t RETCODE_OK if the operation is successful. + * RETCODE_NO_DATA if any dependent TypeIdentifier is unknown to the registry. + * RETCODE_BAD_PARAMETER if both the key and the elements types are fully descriptive. + */ + template + ReturnCode_t get_indirect_hash_map_dependencies( + const T& map_type, + std::unordered_set& type_dependencies) + { + TypeIdentifierSeq type_ids; + + TypeIdentifier key_id = *map_type.key_identifier(); + if (TypeObjectUtils::is_direct_hash_type_identifier(key_id)) + { + add_dependency(key_id, type_dependencies); + type_ids.push_back(key_id); + } + TypeIdentifier element_id = *map_type.element_identifier(); + if (TypeObjectUtils::is_direct_hash_type_identifier(element_id)) + { + add_dependency(element_id, type_dependencies); + type_ids.push_back(element_id); + } + else if (TypeObjectUtils::is_indirect_hash_type_identifier(element_id)) + { + type_ids.push_back(element_id); + } + + if (!type_ids.empty()) + { + return get_type_dependencies_impl(type_ids, type_dependencies); + } + return eprosima::fastdds::dds::RETCODE_BAD_PARAMETER; + } + /** * @brief Get the alias type dependencies. * @@ -299,13 +388,22 @@ class TypeObjectRegistry : public ITypeObjectRegistry const T& alias_type, std::unordered_set& type_dependencies) { + TypeIdentifierSeq type_ids; + TypeIdentifier type_id = alias_type.body().common().related_type(); if (TypeObjectUtils::is_direct_hash_type_identifier(type_id)) { add_dependency(type_id, type_dependencies); - TypeIdentifierSeq type_ids; type_ids.push_back(type_id); - return get_type_dependencies(type_ids, type_dependencies); + } + else if (TypeObjectUtils::is_indirect_hash_type_identifier(type_id)) + { + type_ids.push_back(type_id); + } + + if (!type_ids.empty()) + { + return get_type_dependencies_impl(type_ids, type_dependencies); } return eprosima::fastdds::dds::RETCODE_OK; } @@ -325,6 +423,7 @@ class TypeObjectRegistry : public ITypeObjectRegistry std::unordered_set& type_dependencies) { TypeIdentifierSeq type_ids; + for (auto member : annotation_type.member_seq()) { TypeIdentifier type_id = member.common().member_type_id(); @@ -334,9 +433,10 @@ class TypeObjectRegistry : public ITypeObjectRegistry type_ids.push_back(type_id); } } + if (!type_ids.empty()) { - return get_type_dependencies(type_ids, type_dependencies); + return get_type_dependencies_impl(type_ids, type_dependencies); } return eprosima::fastdds::dds::RETCODE_OK; } @@ -370,10 +470,14 @@ class TypeObjectRegistry : public ITypeObjectRegistry add_dependency(type_id, type_dependencies); type_ids.push_back(type_id); } + else if (TypeObjectUtils::is_indirect_hash_type_identifier(type_id)) + { + type_ids.push_back(type_id); + } } if (!type_ids.empty()) { - return get_type_dependencies(type_ids, type_dependencies); + return get_type_dependencies_impl(type_ids, type_dependencies); } return eprosima::fastdds::dds::RETCODE_OK; } @@ -393,6 +497,7 @@ class TypeObjectRegistry : public ITypeObjectRegistry std::unordered_set& type_dependencies) { TypeIdentifierSeq type_ids; + TypeIdentifier discriminator_type_id = union_type.discriminator().common().type_id(); if (TypeObjectUtils::is_direct_hash_type_identifier(discriminator_type_id)) { @@ -407,10 +512,15 @@ class TypeObjectRegistry : public ITypeObjectRegistry add_dependency(type_id, type_dependencies); type_ids.push_back(type_id); } + else if (TypeObjectUtils::is_indirect_hash_type_identifier(type_id)) + { + type_ids.push_back(type_id); + } } + if (!type_ids.empty()) { - return get_type_dependencies(type_ids, type_dependencies); + return get_type_dependencies_impl(type_ids, type_dependencies); } return eprosima::fastdds::dds::RETCODE_OK; } @@ -429,13 +539,22 @@ class TypeObjectRegistry : public ITypeObjectRegistry const T& collection_type, std::unordered_set& type_dependencies) { + TypeIdentifierSeq type_ids; + TypeIdentifier type_id = collection_type.element().common().type(); if (TypeObjectUtils::is_direct_hash_type_identifier(type_id)) { add_dependency(type_id, type_dependencies); - TypeIdentifierSeq type_ids; type_ids.push_back(type_id); - return get_type_dependencies(type_ids, type_dependencies); + } + else if (TypeObjectUtils::is_indirect_hash_type_identifier(type_id)) + { + type_ids.push_back(type_id); + } + + if (!type_ids.empty()) + { + return get_type_dependencies_impl(type_ids, type_dependencies); } return eprosima::fastdds::dds::RETCODE_OK; } @@ -455,6 +574,7 @@ class TypeObjectRegistry : public ITypeObjectRegistry std::unordered_set& type_dependencies) { TypeIdentifierSeq type_ids; + TypeIdentifier key_type_id = map_type.key().common().type(); if (TypeObjectUtils::is_direct_hash_type_identifier(key_type_id)) { @@ -467,9 +587,14 @@ class TypeObjectRegistry : public ITypeObjectRegistry add_dependency(element_type_id, type_dependencies); type_ids.push_back(element_type_id); } + else if (TypeObjectUtils::is_indirect_hash_type_identifier(element_type_id)) + { + type_ids.push_back(element_type_id); + } + if (!type_ids.empty()) { - return get_type_dependencies(type_ids, type_dependencies); + return get_type_dependencies_impl(type_ids, type_dependencies); } return eprosima::fastdds::dds::RETCODE_OK; } diff --git a/src/cpp/fastdds/xtypes/type_representation/TypeObjectUtils.cpp b/src/cpp/fastdds/xtypes/type_representation/TypeObjectUtils.cpp index 02fd9661ceb..22d168a379f 100644 --- a/src/cpp/fastdds/xtypes/type_representation/TypeObjectUtils.cpp +++ b/src/cpp/fastdds/xtypes/type_representation/TypeObjectUtils.cpp @@ -297,14 +297,15 @@ const PlainMapSTypeDefn TypeObjectUtils::build_plain_map_s_type_defn( type_identifier_consistency(*element_identifier); collection_element_flag_consistency(key_flags); #endif // !defined(NDEBUG) - plain_collection_type_identifier_header_consistency(header, *element_identifier); - map_key_type_identifier_consistency(*key_identifier); PlainMapSTypeDefn plain_map_s_type_defn; + plain_map_s_type_defn.element_identifier(element_identifier); + plain_map_s_type_defn.key_identifier(key_identifier); + TypeIdentifier type_identifier; + type_identifier.map_sdefn(plain_map_s_type_defn); + plain_map_type_components_consistency(header, type_identifier); plain_map_s_type_defn.header(header); plain_map_s_type_defn.bound(bound); - plain_map_s_type_defn.element_identifier(element_identifier); plain_map_s_type_defn.key_flags(key_flags); - plain_map_s_type_defn.key_identifier(key_identifier); return plain_map_s_type_defn; } @@ -321,14 +322,15 @@ const PlainMapLTypeDefn TypeObjectUtils::build_plain_map_l_type_defn( collection_element_flag_consistency(key_flags); #endif // !defined(NDEBUG) l_bound_consistency(bound); - plain_collection_type_identifier_header_consistency(header, *element_identifier); - map_key_type_identifier_consistency(*key_identifier); PlainMapLTypeDefn plain_map_l_type_defn; - plain_map_l_type_defn.header(header); - plain_map_l_type_defn.bound(bound); plain_map_l_type_defn.element_identifier(element_identifier); - plain_map_l_type_defn.key_flags(key_flags); plain_map_l_type_defn.key_identifier(key_identifier); + TypeIdentifier type_identifier; + type_identifier.map_ldefn(plain_map_l_type_defn); + plain_map_type_components_consistency(header, type_identifier); + plain_map_l_type_defn.key_flags(key_flags); + plain_map_l_type_defn.header(header); + plain_map_l_type_defn.bound(bound); return plain_map_l_type_defn; } @@ -2050,6 +2052,122 @@ void TypeObjectUtils::plain_collection_type_identifier_header_consistency( } } +EquivalenceKind TypeObjectUtils::get_map_component_equiv_kind_for_consistency( + const TypeIdentifier& identifier) +{ + if (identifier._d() == TK_NONE) + { + return TK_NONE; + } + else if (is_direct_hash_type_identifier(identifier)) + { + TypeObject type_object; + if (eprosima::fastdds::dds::RETCODE_OK == + type_object_registry_observer().get_type_object(identifier, type_object)) + { + return type_object._d(); + } + else + { + throw InvalidArgumentError("Given TypeIdentifier is not found in TypeObjectRegistry"); + } + } + else if (is_indirect_hash_type_identifier(identifier)) + { + EquivalenceKind element_equiv_kind; + EquivalenceKind key_equiv_kind; + + switch (identifier._d()) + { + case TI_PLAIN_SEQUENCE_SMALL: + return get_map_component_equiv_kind_for_consistency(*identifier.seq_sdefn().element_identifier()); + case TI_PLAIN_SEQUENCE_LARGE: + return get_map_component_equiv_kind_for_consistency(*identifier.seq_ldefn().element_identifier()); + case TI_PLAIN_ARRAY_SMALL: + return get_map_component_equiv_kind_for_consistency(*identifier.array_sdefn().element_identifier()); + case TI_PLAIN_ARRAY_LARGE: + return get_map_component_equiv_kind_for_consistency(*identifier.array_ldefn().element_identifier()); + case TI_PLAIN_MAP_SMALL: + element_equiv_kind = get_map_component_equiv_kind_for_consistency( + *identifier.map_sdefn().element_identifier()); + key_equiv_kind = get_map_component_equiv_kind_for_consistency( + *identifier.map_sdefn().key_identifier()); + + if (EK_BOTH == element_equiv_kind && EK_BOTH == key_equiv_kind) + { + return EK_BOTH; + } + else if ((EK_COMPLETE == element_equiv_kind || EK_BOTH == element_equiv_kind) && + (EK_COMPLETE == key_equiv_kind || EK_BOTH == key_equiv_kind)) + { + return EK_COMPLETE; + } + else if ((EK_MINIMAL == element_equiv_kind || EK_BOTH == element_equiv_kind) && + (EK_MINIMAL == key_equiv_kind || EK_BOTH == key_equiv_kind)) + { + return EK_MINIMAL; + } + else + { + return TK_NONE; + } + case TI_PLAIN_MAP_LARGE: + element_equiv_kind = get_map_component_equiv_kind_for_consistency( + *identifier.map_ldefn().element_identifier()); + key_equiv_kind = get_map_component_equiv_kind_for_consistency( + *identifier.map_ldefn().key_identifier()); + + if (EK_BOTH == element_equiv_kind && EK_BOTH == key_equiv_kind) + { + return EK_BOTH; + } + else if ((EK_COMPLETE == element_equiv_kind || EK_BOTH == element_equiv_kind) && + (EK_COMPLETE == key_equiv_kind || EK_BOTH == key_equiv_kind)) + { + return EK_COMPLETE; + } + else if ((EK_MINIMAL == element_equiv_kind || EK_BOTH == element_equiv_kind) && + (EK_MINIMAL == key_equiv_kind || EK_BOTH == key_equiv_kind)) + { + return EK_MINIMAL; + } + else + { + return TK_NONE; + } + default: + return TK_NONE; + } + } + else + { + return EK_BOTH; + } +} + +void TypeObjectUtils::plain_map_type_components_consistency( + const PlainCollectionHeader& header, + const TypeIdentifier& identifier) +{ + switch (identifier._d()) + { + case TI_PLAIN_MAP_SMALL: + map_key_type_identifier_consistency(*identifier.map_sdefn().key_identifier()); + break; + case TI_PLAIN_MAP_LARGE: + map_key_type_identifier_consistency(*identifier.map_ldefn().key_identifier()); + break; + default: + throw InvalidArgumentError("Inconsistent TypeIdentifier, it is not a map type"); + } + + if (header.equiv_kind() != get_map_component_equiv_kind_for_consistency(identifier)) + { + throw InvalidArgumentError( + "Inconsistent PlainCollectionHeader, different equiv_kind between header and components"); + } +} + void TypeObjectUtils::map_key_type_identifier_consistency( const TypeIdentifier& key_identifier) { @@ -2142,7 +2260,9 @@ void TypeObjectUtils::map_sdefn_consistency( plain_collection_header_consistency(plain_map.header()); type_identifier_consistency(*plain_map.element_identifier()); collection_element_flag_consistency(plain_map.key_flags()); - plain_collection_type_identifier_header_consistency(plain_map.header(), *plain_map.element_identifier()); + TypeIdentifier type_identifier; + type_identifier.map_sdefn(plain_map); + plain_map_type_components_consistency(plain_map.header(), type_identifier); map_key_type_identifier_consistency(*plain_map.key_identifier()); } @@ -2153,7 +2273,10 @@ void TypeObjectUtils::map_ldefn_consistency( l_bound_consistency(plain_map.bound()); type_identifier_consistency(*plain_map.element_identifier()); collection_element_flag_consistency(plain_map.key_flags()); - plain_collection_type_identifier_header_consistency(plain_map.header(), *plain_map.element_identifier()); + TypeIdentifier type_identifier; + type_identifier.map_ldefn(plain_map); + plain_map_type_components_consistency(plain_map.header(), type_identifier); + map_key_type_identifier_consistency(*plain_map.key_identifier()); } diff --git a/test/unittest/dds/xtypes/type_representation/TypeObjectUtilsTests.cpp b/test/unittest/dds/xtypes/type_representation/TypeObjectUtilsTests.cpp index e2ddbaf01d7..48d20f3f588 100644 --- a/test/unittest/dds/xtypes/type_representation/TypeObjectUtilsTests.cpp +++ b/test/unittest/dds/xtypes/type_representation/TypeObjectUtilsTests.cpp @@ -76,6 +76,34 @@ void register_empty_structure_type_object() TypeObjectUtils::build_and_register_struct_type_object(struct_type, empty_struct_name); } +void register_plain_seq_type_object( + eprosima::fastcdr::external complete_typeid) +{ + std::string plain_seq_name = "plain_sequence"; + CollectionElementFlag flags = TypeObjectUtils::build_collection_element_flag( + eprosima::fastdds::dds::xtypes::TryConstructKind::USE_DEFAULT, false); + PlainCollectionHeader header = TypeObjectUtils::build_plain_collection_header(EK_COMPLETE, flags); + PlainSequenceSElemDefn plain_seq = TypeObjectUtils::build_plain_sequence_s_elem_defn( + header, 255, complete_typeid); + TypeObjectUtils::build_and_register_s_sequence_type_identifier(plain_seq, plain_seq_name); +} + +void register_alias_type_object() +{ + TypeIdentifier primitive_type_id; + primitive_type_id._d(TK_INT16); + CommonAliasBody int16_common_body = TypeObjectUtils::build_common_alias_body(0, primitive_type_id); + CompleteAliasBody int16_body = TypeObjectUtils::build_complete_alias_body(int16_common_body, + eprosima::fastcdr::optional(), + eprosima::fastcdr::optional()); + CompleteTypeDetail empty_type_detail = TypeObjectUtils::build_complete_type_detail( + eprosima::fastcdr::optional(), + eprosima::fastcdr::optional(), "type_name"); + CompleteAliasHeader alias_header = TypeObjectUtils::build_complete_alias_header(empty_type_detail); + CompleteAliasType alias_type = TypeObjectUtils::build_complete_alias_type(0, alias_header, int16_body); + TypeObjectUtils::build_and_register_alias_type_object(alias_type, "int16_alias"); +} + // Build PlainSequenceSElemDefn with inconsistent parameters. TEST(TypeObjectUtilsTests, build_plain_sequence_s_elem_defn_inconsistencies) { @@ -461,93 +489,426 @@ TEST(TypeObjectUtilsTests, build_plain_map_s_type_defn_inconsistencies) #if !defined(NDEBUG) PlainCollectionHeader wrong_header; // Inconsistent header CollectionElementFlags - EXPECT_THROW(PlainMapSTypeDefn plain_seq = TypeObjectUtils::build_plain_map_s_type_defn( + EXPECT_THROW(PlainMapSTypeDefn plain_map = TypeObjectUtils::build_plain_map_s_type_defn( wrong_header, 10, test_identifier, flags, key_identifier), InvalidArgumentError); wrong_header.element_flags(flags); // Inconsistent header EquivalenceKind - EXPECT_THROW(PlainMapSTypeDefn plain_seq = TypeObjectUtils::build_plain_map_s_type_defn( + EXPECT_THROW(PlainMapSTypeDefn plain_map = TypeObjectUtils::build_plain_map_s_type_defn( wrong_header, 10, test_identifier, flags, key_identifier), InvalidArgumentError); // Non-initialized TypeIdentifier - EXPECT_THROW(PlainMapSTypeDefn plain_seq = TypeObjectUtils::build_plain_map_s_type_defn( + EXPECT_THROW(PlainMapSTypeDefn plain_map = TypeObjectUtils::build_plain_map_s_type_defn( complete_header, 10, test_identifier, flags, key_identifier), InvalidArgumentError); #endif // !defined(NDEBUG) // Check SBound consistency SBound wrong_bound = 0; - EXPECT_THROW(PlainMapSTypeDefn plain_seq = TypeObjectUtils::build_plain_map_s_type_defn( + EXPECT_THROW(PlainMapSTypeDefn plain_map = TypeObjectUtils::build_plain_map_s_type_defn( complete_header, wrong_bound, test_identifier, flags, key_identifier), InvalidArgumentError); // Primitive TypeIdentifier EXPECT_NO_THROW(test_identifier->_d(TK_BOOLEAN)); // TypeIdentifier inconsistent with complete header - EXPECT_THROW(PlainMapSTypeDefn plain_seq = TypeObjectUtils::build_plain_map_s_type_defn( + EXPECT_THROW(PlainMapSTypeDefn plain_map = TypeObjectUtils::build_plain_map_s_type_defn( complete_header, 10, test_identifier, flags, key_identifier), InvalidArgumentError); PlainCollectionHeader minimal_header = TypeObjectUtils::build_plain_collection_header( EK_MINIMAL, flags); // TypeIdentifier inconsistent with minimal header - EXPECT_THROW(PlainMapSTypeDefn plain_seq = TypeObjectUtils::build_plain_map_s_type_defn( + EXPECT_THROW(PlainMapSTypeDefn plain_map = TypeObjectUtils::build_plain_map_s_type_defn( minimal_header, 10, test_identifier, flags, key_identifier), InvalidArgumentError); PlainCollectionHeader fully_descriptive_header = TypeObjectUtils::build_plain_collection_header( EK_BOTH, flags); // Wrong key_flags CollectionElementFlag wrong_flags = 0; - EXPECT_THROW(PlainMapSTypeDefn plain_seq = TypeObjectUtils::build_plain_map_s_type_defn( + EXPECT_THROW(PlainMapSTypeDefn plain_map = TypeObjectUtils::build_plain_map_s_type_defn( fully_descriptive_header, 10, test_identifier, wrong_flags, key_identifier), InvalidArgumentError); #if !defined(NDEBUG) // Uninitialized key_identifier - EXPECT_THROW(PlainMapSTypeDefn plain_seq = TypeObjectUtils::build_plain_map_s_type_defn( + EXPECT_THROW(PlainMapSTypeDefn plain_map = TypeObjectUtils::build_plain_map_s_type_defn( fully_descriptive_header, 10, test_identifier, flags, key_identifier), InvalidArgumentError); #endif // !defined(NDEBUG) // Non-integer key identifier EXPECT_NO_THROW(key_identifier->_d(TK_FLOAT32)); - EXPECT_THROW(PlainMapSTypeDefn plain_seq = TypeObjectUtils::build_plain_map_s_type_defn( + EXPECT_THROW(PlainMapSTypeDefn plain_map = TypeObjectUtils::build_plain_map_s_type_defn( fully_descriptive_header, 10, test_identifier, flags, key_identifier), InvalidArgumentError); // TypeIdentifier consistent with fully-descriptive header and integer key identifier EXPECT_NO_THROW(key_identifier->_d(TK_INT64)); - EXPECT_NO_THROW(PlainMapSTypeDefn plain_seq = TypeObjectUtils::build_plain_map_s_type_defn( + EXPECT_NO_THROW(PlainMapSTypeDefn plain_map = TypeObjectUtils::build_plain_map_s_type_defn( fully_descriptive_header, 10, test_identifier, flags, key_identifier)); StringSTypeDefn string_type_def = TypeObjectUtils::build_string_s_type_defn(50); EXPECT_NO_THROW(key_identifier->string_sdefn(string_type_def)); - EXPECT_NO_THROW(PlainMapSTypeDefn plain_seq = TypeObjectUtils::build_plain_map_s_type_defn( + EXPECT_NO_THROW(PlainMapSTypeDefn plain_map = TypeObjectUtils::build_plain_map_s_type_defn( fully_descriptive_header, 10, test_identifier, flags, key_identifier)); - // Change discriminator to EK_COMPLETE + + // Get EK_COMPLETE and EK_MINIMAL TypeIdentifiers register_empty_structure_type_object(); TypeIdentifierPair type_ids; + eprosima::fastcdr::external complete_typeid; + eprosima::fastcdr::external minimal_typeid; DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers("empty_structure", type_ids); if (EK_COMPLETE == type_ids.type_identifier1()._d()) { - test_identifier = eprosima::fastcdr::external(new TypeIdentifier(type_ids.type_identifier1())); + complete_typeid = eprosima::fastcdr::external(new TypeIdentifier(type_ids.type_identifier1())); + minimal_typeid = eprosima::fastcdr::external(new TypeIdentifier(type_ids.type_identifier2())); } else { - test_identifier = eprosima::fastcdr::external(new TypeIdentifier(type_ids.type_identifier2())); + complete_typeid = eprosima::fastcdr::external(new TypeIdentifier(type_ids.type_identifier2())); + minimal_typeid = eprosima::fastcdr::external(new TypeIdentifier(type_ids.type_identifier1())); } - // TypeIdentifier consistent with complete header - EXPECT_NO_THROW(PlainMapSTypeDefn plain_seq = TypeObjectUtils::build_plain_map_s_type_defn( - complete_header, 10, test_identifier, flags, key_identifier)); - // TypeIdentifier inconsistent with minimal header - EXPECT_THROW(PlainMapSTypeDefn plain_seq = TypeObjectUtils::build_plain_map_s_type_defn( - minimal_header, 10, test_identifier, flags, key_identifier), InvalidArgumentError); - // TypeIdentifier inconsistent with fully-descriptive header - EXPECT_THROW(PlainMapSTypeDefn plain_seq = TypeObjectUtils::build_plain_map_s_type_defn( - fully_descriptive_header, 10, test_identifier, flags, key_identifier), InvalidArgumentError); - // Change discriminator to EK_MINIMAL + + register_plain_seq_type_object(complete_typeid); + eprosima::fastcdr::external complete_indirect_id; + eprosima::fastcdr::external minimal_indirect_id; + DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers("plain_sequence", type_ids); if (EK_COMPLETE == type_ids.type_identifier1()._d()) { - test_identifier = eprosima::fastcdr::external(new TypeIdentifier(type_ids.type_identifier2())); + complete_indirect_id = + eprosima::fastcdr::external(new TypeIdentifier(type_ids.type_identifier1())); + minimal_indirect_id = + eprosima::fastcdr::external(new TypeIdentifier(type_ids.type_identifier2())); } else { - test_identifier = eprosima::fastcdr::external(new TypeIdentifier(type_ids.type_identifier1())); + complete_indirect_id = + eprosima::fastcdr::external(new TypeIdentifier(type_ids.type_identifier2())); + minimal_indirect_id = + eprosima::fastcdr::external(new TypeIdentifier(type_ids.type_identifier1())); } - // TypeIdentifier inconsistent with complete header - EXPECT_THROW(PlainMapSTypeDefn plain_seq = TypeObjectUtils::build_plain_map_s_type_defn( + + register_alias_type_object(); + eprosima::fastcdr::external complete_alias_id; + eprosima::fastcdr::external minimal_alias_id; + DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers("int16_alias", type_ids); + if (EK_COMPLETE == type_ids.type_identifier1()._d()) + { + complete_alias_id = + eprosima::fastcdr::external(new TypeIdentifier(type_ids.type_identifier1())); + minimal_alias_id = + eprosima::fastcdr::external(new TypeIdentifier(type_ids.type_identifier2())); + } + else + { + complete_alias_id = + eprosima::fastcdr::external(new TypeIdentifier(type_ids.type_identifier2())); + minimal_alias_id = + eprosima::fastcdr::external(new TypeIdentifier(type_ids.type_identifier1())); + } + + EXPECT_NO_THROW(PlainMapSTypeDefn plain_map = TypeObjectUtils::build_plain_map_s_type_defn( + fully_descriptive_header, 10, test_identifier, flags, key_identifier)); + EXPECT_THROW(PlainMapSTypeDefn plain_map = TypeObjectUtils::build_plain_map_s_type_defn( + fully_descriptive_header, 10, test_identifier, flags, complete_typeid), InvalidArgumentError); //Invalid key + EXPECT_THROW(PlainMapSTypeDefn plain_map = TypeObjectUtils::build_plain_map_s_type_defn( + fully_descriptive_header, 10, test_identifier, flags, complete_indirect_id), InvalidArgumentError); //Invalid key + EXPECT_THROW(PlainMapSTypeDefn plain_map = TypeObjectUtils::build_plain_map_s_type_defn( + fully_descriptive_header, 10, test_identifier, flags, complete_alias_id), InvalidArgumentError); + EXPECT_THROW(PlainMapSTypeDefn plain_map = TypeObjectUtils::build_plain_map_s_type_defn( + fully_descriptive_header, 10, test_identifier, flags, minimal_typeid), InvalidArgumentError); //Invalid key + EXPECT_THROW(PlainMapSTypeDefn plain_map = TypeObjectUtils::build_plain_map_s_type_defn( + fully_descriptive_header, 10, test_identifier, flags, minimal_indirect_id), InvalidArgumentError); //Invalid key + EXPECT_THROW(PlainMapSTypeDefn plain_map = TypeObjectUtils::build_plain_map_s_type_defn( + fully_descriptive_header, 10, test_identifier, flags, minimal_alias_id), InvalidArgumentError); + + EXPECT_THROW(PlainMapSTypeDefn plain_map = TypeObjectUtils::build_plain_map_s_type_defn( + fully_descriptive_header, 10, complete_typeid, flags, key_identifier), InvalidArgumentError); + EXPECT_THROW(PlainMapSTypeDefn plain_map = TypeObjectUtils::build_plain_map_s_type_defn( + fully_descriptive_header, 10, complete_typeid, flags, complete_typeid), InvalidArgumentError); //Invalid key + EXPECT_THROW(PlainMapSTypeDefn plain_map = TypeObjectUtils::build_plain_map_s_type_defn( + fully_descriptive_header, 10, complete_typeid, flags, complete_indirect_id), InvalidArgumentError); //Invalid key + EXPECT_THROW(PlainMapSTypeDefn plain_map = TypeObjectUtils::build_plain_map_s_type_defn( + fully_descriptive_header, 10, complete_typeid, flags, complete_alias_id), InvalidArgumentError); + EXPECT_THROW(PlainMapSTypeDefn plain_map = TypeObjectUtils::build_plain_map_s_type_defn( + fully_descriptive_header, 10, complete_typeid, flags, minimal_typeid), InvalidArgumentError); //Invalid key + EXPECT_THROW(PlainMapSTypeDefn plain_map = TypeObjectUtils::build_plain_map_s_type_defn( + fully_descriptive_header, 10, complete_typeid, flags, minimal_indirect_id), InvalidArgumentError); //Invalid key + EXPECT_THROW(PlainMapSTypeDefn plain_map = TypeObjectUtils::build_plain_map_s_type_defn( + fully_descriptive_header, 10, complete_typeid, flags, minimal_alias_id), InvalidArgumentError); + + EXPECT_THROW(PlainMapSTypeDefn plain_map = TypeObjectUtils::build_plain_map_s_type_defn( + fully_descriptive_header, 10, complete_indirect_id, flags, key_identifier), InvalidArgumentError); + EXPECT_THROW(PlainMapSTypeDefn plain_map = TypeObjectUtils::build_plain_map_s_type_defn( + fully_descriptive_header, 10, complete_indirect_id, flags, complete_typeid), InvalidArgumentError); //Invalid key + EXPECT_THROW(PlainMapSTypeDefn plain_map = TypeObjectUtils::build_plain_map_s_type_defn( + fully_descriptive_header, 10, complete_indirect_id, flags, complete_indirect_id), InvalidArgumentError); //Invalid key + EXPECT_THROW(PlainMapSTypeDefn plain_map = TypeObjectUtils::build_plain_map_s_type_defn( + fully_descriptive_header, 10, complete_indirect_id, flags, complete_alias_id), InvalidArgumentError); + EXPECT_THROW(PlainMapSTypeDefn plain_map = TypeObjectUtils::build_plain_map_s_type_defn( + fully_descriptive_header, 10, complete_indirect_id, flags, minimal_typeid), InvalidArgumentError); //Invalid key + EXPECT_THROW(PlainMapSTypeDefn plain_map = TypeObjectUtils::build_plain_map_s_type_defn( + fully_descriptive_header, 10, complete_indirect_id, flags, minimal_indirect_id), InvalidArgumentError); //Invalid key + EXPECT_THROW(PlainMapSTypeDefn plain_map = TypeObjectUtils::build_plain_map_s_type_defn( + fully_descriptive_header, 10, complete_indirect_id, flags, minimal_alias_id), InvalidArgumentError); + + EXPECT_THROW(PlainMapSTypeDefn plain_map = TypeObjectUtils::build_plain_map_s_type_defn( + fully_descriptive_header, 10, complete_alias_id, flags, key_identifier), InvalidArgumentError); + EXPECT_THROW(PlainMapSTypeDefn plain_map = TypeObjectUtils::build_plain_map_s_type_defn( + fully_descriptive_header, 10, complete_alias_id, flags, complete_typeid), InvalidArgumentError); //Invalid key + EXPECT_THROW(PlainMapSTypeDefn plain_map = TypeObjectUtils::build_plain_map_s_type_defn( + fully_descriptive_header, 10, complete_alias_id, flags, complete_indirect_id), InvalidArgumentError); //Invalid key + EXPECT_THROW(PlainMapSTypeDefn plain_map = TypeObjectUtils::build_plain_map_s_type_defn( + fully_descriptive_header, 10, complete_alias_id, flags, complete_alias_id), InvalidArgumentError); + EXPECT_THROW(PlainMapSTypeDefn plain_map = TypeObjectUtils::build_plain_map_s_type_defn( + fully_descriptive_header, 10, complete_alias_id, flags, minimal_typeid), InvalidArgumentError); //Invalid key + EXPECT_THROW(PlainMapSTypeDefn plain_map = TypeObjectUtils::build_plain_map_s_type_defn( + fully_descriptive_header, 10, complete_alias_id, flags, minimal_indirect_id), InvalidArgumentError); //Invalid key + EXPECT_THROW(PlainMapSTypeDefn plain_map = TypeObjectUtils::build_plain_map_s_type_defn( + fully_descriptive_header, 10, complete_alias_id, flags, minimal_alias_id), InvalidArgumentError); + + EXPECT_THROW(PlainMapSTypeDefn plain_map = TypeObjectUtils::build_plain_map_s_type_defn( + fully_descriptive_header, 10, minimal_typeid, flags, key_identifier), InvalidArgumentError); + EXPECT_THROW(PlainMapSTypeDefn plain_map = TypeObjectUtils::build_plain_map_s_type_defn( + fully_descriptive_header, 10, minimal_typeid, flags, complete_typeid), InvalidArgumentError); //Invalid key + EXPECT_THROW(PlainMapSTypeDefn plain_map = TypeObjectUtils::build_plain_map_s_type_defn( + fully_descriptive_header, 10, minimal_typeid, flags, complete_indirect_id), InvalidArgumentError); //Invalid key + EXPECT_THROW(PlainMapSTypeDefn plain_map = TypeObjectUtils::build_plain_map_s_type_defn( + fully_descriptive_header, 10, minimal_typeid, flags, complete_alias_id), InvalidArgumentError); + EXPECT_THROW(PlainMapSTypeDefn plain_map = TypeObjectUtils::build_plain_map_s_type_defn( + fully_descriptive_header, 10, minimal_typeid, flags, minimal_typeid), InvalidArgumentError); //Invalid key + EXPECT_THROW(PlainMapSTypeDefn plain_map = TypeObjectUtils::build_plain_map_s_type_defn( + fully_descriptive_header, 10, minimal_typeid, flags, minimal_indirect_id), InvalidArgumentError); //Invalid key + EXPECT_THROW(PlainMapSTypeDefn plain_map = TypeObjectUtils::build_plain_map_s_type_defn( + fully_descriptive_header, 10, minimal_typeid, flags, minimal_alias_id), InvalidArgumentError); + + EXPECT_THROW(PlainMapSTypeDefn plain_map = TypeObjectUtils::build_plain_map_s_type_defn( + fully_descriptive_header, 10, minimal_indirect_id, flags, key_identifier), InvalidArgumentError); + EXPECT_THROW(PlainMapSTypeDefn plain_map = TypeObjectUtils::build_plain_map_s_type_defn( + fully_descriptive_header, 10, minimal_indirect_id, flags, complete_typeid), InvalidArgumentError); //Invalid key + EXPECT_THROW(PlainMapSTypeDefn plain_map = TypeObjectUtils::build_plain_map_s_type_defn( + fully_descriptive_header, 10, minimal_indirect_id, flags, complete_indirect_id), InvalidArgumentError); //Invalid key + EXPECT_THROW(PlainMapSTypeDefn plain_map = TypeObjectUtils::build_plain_map_s_type_defn( + fully_descriptive_header, 10, minimal_indirect_id, flags, complete_alias_id), InvalidArgumentError); + EXPECT_THROW(PlainMapSTypeDefn plain_map = TypeObjectUtils::build_plain_map_s_type_defn( + fully_descriptive_header, 10, minimal_indirect_id, flags, minimal_typeid), InvalidArgumentError); //Invalid key + EXPECT_THROW(PlainMapSTypeDefn plain_map = TypeObjectUtils::build_plain_map_s_type_defn( + fully_descriptive_header, 10, minimal_indirect_id, flags, minimal_indirect_id), InvalidArgumentError); //Invalid key + EXPECT_THROW(PlainMapSTypeDefn plain_map = TypeObjectUtils::build_plain_map_s_type_defn( + fully_descriptive_header, 10, minimal_indirect_id, flags, minimal_alias_id), InvalidArgumentError); + + EXPECT_THROW(PlainMapSTypeDefn plain_map = TypeObjectUtils::build_plain_map_s_type_defn( + fully_descriptive_header, 10, minimal_alias_id, flags, key_identifier), InvalidArgumentError); + EXPECT_THROW(PlainMapSTypeDefn plain_map = TypeObjectUtils::build_plain_map_s_type_defn( + fully_descriptive_header, 10, minimal_alias_id, flags, complete_typeid), InvalidArgumentError); //Invalid key + EXPECT_THROW(PlainMapSTypeDefn plain_map = TypeObjectUtils::build_plain_map_s_type_defn( + fully_descriptive_header, 10, minimal_alias_id, flags, complete_indirect_id), InvalidArgumentError); //Invalid key + EXPECT_THROW(PlainMapSTypeDefn plain_map = TypeObjectUtils::build_plain_map_s_type_defn( + fully_descriptive_header, 10, minimal_alias_id, flags, complete_alias_id), InvalidArgumentError); + EXPECT_THROW(PlainMapSTypeDefn plain_map = TypeObjectUtils::build_plain_map_s_type_defn( + fully_descriptive_header, 10, minimal_alias_id, flags, minimal_typeid), InvalidArgumentError); //Invalid key + EXPECT_THROW(PlainMapSTypeDefn plain_map = TypeObjectUtils::build_plain_map_s_type_defn( + fully_descriptive_header, 10, minimal_alias_id, flags, minimal_indirect_id), InvalidArgumentError); //Invalid key + EXPECT_THROW(PlainMapSTypeDefn plain_map = TypeObjectUtils::build_plain_map_s_type_defn( + fully_descriptive_header, 10, minimal_alias_id, flags, minimal_alias_id), InvalidArgumentError); + + + EXPECT_THROW(PlainMapSTypeDefn plain_map = TypeObjectUtils::build_plain_map_s_type_defn( complete_header, 10, test_identifier, flags, key_identifier), InvalidArgumentError); - // TypeIdentifier consistent with minimal header - EXPECT_NO_THROW(PlainMapSTypeDefn plain_seq = TypeObjectUtils::build_plain_map_s_type_defn( - minimal_header, 10, test_identifier, flags, key_identifier)); - // TypeIdentifier inconsistent with fully-descriptive header - EXPECT_THROW(PlainMapSTypeDefn plain_seq = TypeObjectUtils::build_plain_map_s_type_defn( - fully_descriptive_header, 10, test_identifier, flags, key_identifier), InvalidArgumentError); + EXPECT_THROW(PlainMapSTypeDefn plain_map = TypeObjectUtils::build_plain_map_s_type_defn( + complete_header, 10, test_identifier, flags, complete_typeid), InvalidArgumentError); //Invalid key/// + EXPECT_THROW(PlainMapSTypeDefn plain_map = TypeObjectUtils::build_plain_map_s_type_defn( + complete_header, 10, test_identifier, flags, complete_indirect_id), InvalidArgumentError); //Invalid key/// + EXPECT_NO_THROW(PlainMapSTypeDefn plain_map = TypeObjectUtils::build_plain_map_s_type_defn( + complete_header, 10, test_identifier, flags, complete_alias_id)); + EXPECT_THROW(PlainMapSTypeDefn plain_map = TypeObjectUtils::build_plain_map_s_type_defn( + complete_header, 10, test_identifier, flags, minimal_typeid), InvalidArgumentError); //Invalid key + EXPECT_THROW(PlainMapSTypeDefn plain_map = TypeObjectUtils::build_plain_map_s_type_defn( + complete_header, 10, test_identifier, flags, minimal_indirect_id), InvalidArgumentError); //Invalid key + EXPECT_THROW(PlainMapSTypeDefn plain_map = TypeObjectUtils::build_plain_map_s_type_defn( + complete_header, 10, test_identifier, flags, minimal_alias_id), InvalidArgumentError); + + EXPECT_NO_THROW(PlainMapSTypeDefn plain_map = TypeObjectUtils::build_plain_map_s_type_defn( + complete_header, 10, complete_typeid, flags, key_identifier)); + EXPECT_THROW(PlainMapSTypeDefn plain_map = TypeObjectUtils::build_plain_map_s_type_defn( + complete_header, 10, complete_typeid, flags, complete_typeid), InvalidArgumentError); //Invalid key + EXPECT_THROW(PlainMapSTypeDefn plain_map = TypeObjectUtils::build_plain_map_s_type_defn( + complete_header, 10, complete_typeid, flags, complete_indirect_id), InvalidArgumentError); //Invalid key + EXPECT_NO_THROW(PlainMapSTypeDefn plain_map = TypeObjectUtils::build_plain_map_s_type_defn( + complete_header, 10, complete_typeid, flags, complete_alias_id)); + EXPECT_THROW(PlainMapSTypeDefn plain_map = TypeObjectUtils::build_plain_map_s_type_defn( + complete_header, 10, complete_typeid, flags, minimal_typeid), InvalidArgumentError); //Invalid key + EXPECT_THROW(PlainMapSTypeDefn plain_map = TypeObjectUtils::build_plain_map_s_type_defn( + complete_header, 10, complete_typeid, flags, minimal_indirect_id), InvalidArgumentError); //Invalid key + EXPECT_THROW(PlainMapSTypeDefn plain_map = TypeObjectUtils::build_plain_map_s_type_defn( + complete_header, 10, complete_typeid, flags, minimal_alias_id), InvalidArgumentError); + + EXPECT_NO_THROW(PlainMapSTypeDefn plain_map = TypeObjectUtils::build_plain_map_s_type_defn( + complete_header, 10, complete_indirect_id, flags, key_identifier)); + EXPECT_THROW(PlainMapSTypeDefn plain_map = TypeObjectUtils::build_plain_map_s_type_defn( + complete_header, 10, complete_indirect_id, flags, complete_typeid), InvalidArgumentError); //Invalid key + EXPECT_THROW(PlainMapSTypeDefn plain_map = TypeObjectUtils::build_plain_map_s_type_defn( + complete_header, 10, complete_indirect_id, flags, complete_indirect_id), InvalidArgumentError); //Invalid key + EXPECT_NO_THROW(PlainMapSTypeDefn plain_map = TypeObjectUtils::build_plain_map_s_type_defn( + complete_header, 10, complete_indirect_id, flags, complete_alias_id)); + EXPECT_THROW(PlainMapSTypeDefn plain_map = TypeObjectUtils::build_plain_map_s_type_defn( + complete_header, 10, complete_indirect_id, flags, minimal_typeid), InvalidArgumentError); //Invalid key + EXPECT_THROW(PlainMapSTypeDefn plain_map = TypeObjectUtils::build_plain_map_s_type_defn( + complete_header, 10, complete_indirect_id, flags, minimal_indirect_id), InvalidArgumentError); //Invalid key + EXPECT_THROW(PlainMapSTypeDefn plain_map = TypeObjectUtils::build_plain_map_s_type_defn( + complete_header, 10, complete_indirect_id, flags, minimal_alias_id), InvalidArgumentError); + + EXPECT_NO_THROW(PlainMapSTypeDefn plain_map = TypeObjectUtils::build_plain_map_s_type_defn( + complete_header, 10, complete_alias_id, flags, key_identifier)); + EXPECT_THROW(PlainMapSTypeDefn plain_map = TypeObjectUtils::build_plain_map_s_type_defn( + complete_header, 10, complete_alias_id, flags, complete_typeid), InvalidArgumentError); //Invalid key + EXPECT_THROW(PlainMapSTypeDefn plain_map = TypeObjectUtils::build_plain_map_s_type_defn( + complete_header, 10, complete_alias_id, flags, complete_indirect_id), InvalidArgumentError); //Invalid key + EXPECT_NO_THROW(PlainMapSTypeDefn plain_map = TypeObjectUtils::build_plain_map_s_type_defn( + complete_header, 10, complete_alias_id, flags, complete_alias_id)); + EXPECT_THROW(PlainMapSTypeDefn plain_map = TypeObjectUtils::build_plain_map_s_type_defn( + complete_header, 10, complete_alias_id, flags, minimal_typeid), InvalidArgumentError); //Invalid key + EXPECT_THROW(PlainMapSTypeDefn plain_map = TypeObjectUtils::build_plain_map_s_type_defn( + complete_header, 10, complete_alias_id, flags, minimal_indirect_id), InvalidArgumentError); //Invalid key + EXPECT_THROW(PlainMapSTypeDefn plain_map = TypeObjectUtils::build_plain_map_s_type_defn( + complete_header, 10, complete_alias_id, flags, minimal_alias_id), InvalidArgumentError); + + EXPECT_THROW(PlainMapSTypeDefn plain_map = TypeObjectUtils::build_plain_map_s_type_defn( + complete_header, 10, minimal_typeid, flags, key_identifier), InvalidArgumentError); + EXPECT_THROW(PlainMapSTypeDefn plain_map = TypeObjectUtils::build_plain_map_s_type_defn( + complete_header, 10, minimal_typeid, flags, complete_typeid), InvalidArgumentError); //Invalid key + EXPECT_THROW(PlainMapSTypeDefn plain_map = TypeObjectUtils::build_plain_map_s_type_defn( + complete_header, 10, minimal_typeid, flags, complete_indirect_id), InvalidArgumentError); //Invalid key + EXPECT_THROW(PlainMapSTypeDefn plain_map = TypeObjectUtils::build_plain_map_s_type_defn( + complete_header, 10, minimal_typeid, flags, complete_alias_id), InvalidArgumentError); + EXPECT_THROW(PlainMapSTypeDefn plain_map = TypeObjectUtils::build_plain_map_s_type_defn( + complete_header, 10, minimal_typeid, flags, minimal_typeid), InvalidArgumentError); //Invalid key + EXPECT_THROW(PlainMapSTypeDefn plain_map = TypeObjectUtils::build_plain_map_s_type_defn( + complete_header, 10, minimal_typeid, flags, minimal_indirect_id), InvalidArgumentError); //Invalid key + EXPECT_THROW(PlainMapSTypeDefn plain_map = TypeObjectUtils::build_plain_map_s_type_defn( + complete_header, 10, minimal_typeid, flags, minimal_alias_id), InvalidArgumentError); + + EXPECT_THROW(PlainMapSTypeDefn plain_map = TypeObjectUtils::build_plain_map_s_type_defn( + complete_header, 10, minimal_indirect_id, flags, key_identifier), InvalidArgumentError); + EXPECT_THROW(PlainMapSTypeDefn plain_map = TypeObjectUtils::build_plain_map_s_type_defn( + complete_header, 10, minimal_indirect_id, flags, complete_typeid), InvalidArgumentError); //Invalid key + EXPECT_THROW(PlainMapSTypeDefn plain_map = TypeObjectUtils::build_plain_map_s_type_defn( + complete_header, 10, minimal_indirect_id, flags, complete_indirect_id), InvalidArgumentError); //Invalid key + EXPECT_THROW(PlainMapSTypeDefn plain_map = TypeObjectUtils::build_plain_map_s_type_defn( + complete_header, 10, minimal_indirect_id, flags, complete_alias_id), InvalidArgumentError); + EXPECT_THROW(PlainMapSTypeDefn plain_map = TypeObjectUtils::build_plain_map_s_type_defn( + complete_header, 10, minimal_indirect_id, flags, minimal_typeid), InvalidArgumentError); //Invalid key + EXPECT_THROW(PlainMapSTypeDefn plain_map = TypeObjectUtils::build_plain_map_s_type_defn( + complete_header, 10, minimal_indirect_id, flags, minimal_indirect_id), InvalidArgumentError); //Invalid key + EXPECT_THROW(PlainMapSTypeDefn plain_map = TypeObjectUtils::build_plain_map_s_type_defn( + complete_header, 10, minimal_indirect_id, flags, minimal_alias_id), InvalidArgumentError); + + EXPECT_THROW(PlainMapSTypeDefn plain_map = TypeObjectUtils::build_plain_map_s_type_defn( + complete_header, 10, minimal_alias_id, flags, key_identifier), InvalidArgumentError); + EXPECT_THROW(PlainMapSTypeDefn plain_map = TypeObjectUtils::build_plain_map_s_type_defn( + complete_header, 10, minimal_alias_id, flags, complete_typeid), InvalidArgumentError); //Invalid key + EXPECT_THROW(PlainMapSTypeDefn plain_map = TypeObjectUtils::build_plain_map_s_type_defn( + complete_header, 10, minimal_alias_id, flags, complete_indirect_id), InvalidArgumentError); //Invalid key + EXPECT_THROW(PlainMapSTypeDefn plain_map = TypeObjectUtils::build_plain_map_s_type_defn( + complete_header, 10, minimal_alias_id, flags, complete_alias_id), InvalidArgumentError); + EXPECT_THROW(PlainMapSTypeDefn plain_map = TypeObjectUtils::build_plain_map_s_type_defn( + complete_header, 10, minimal_alias_id, flags, minimal_typeid), InvalidArgumentError); //Invalid key + EXPECT_THROW(PlainMapSTypeDefn plain_map = TypeObjectUtils::build_plain_map_s_type_defn( + complete_header, 10, minimal_alias_id, flags, minimal_indirect_id), InvalidArgumentError); //Invalid key + EXPECT_THROW(PlainMapSTypeDefn plain_map = TypeObjectUtils::build_plain_map_s_type_defn( + complete_header, 10, minimal_alias_id, flags, minimal_alias_id), InvalidArgumentError); + + + EXPECT_THROW(PlainMapSTypeDefn plain_map = TypeObjectUtils::build_plain_map_s_type_defn( + minimal_header, 10, test_identifier, flags, key_identifier), InvalidArgumentError); + EXPECT_THROW(PlainMapSTypeDefn plain_map = TypeObjectUtils::build_plain_map_s_type_defn( + minimal_header, 10, test_identifier, flags, complete_typeid), InvalidArgumentError); //Invalid key + EXPECT_THROW(PlainMapSTypeDefn plain_map = TypeObjectUtils::build_plain_map_s_type_defn( + minimal_header, 10, test_identifier, flags, complete_indirect_id), InvalidArgumentError); //Invalid key + EXPECT_THROW(PlainMapSTypeDefn plain_map = TypeObjectUtils::build_plain_map_s_type_defn( + minimal_header, 10, test_identifier, flags, complete_alias_id), InvalidArgumentError); + EXPECT_THROW(PlainMapSTypeDefn plain_map = TypeObjectUtils::build_plain_map_s_type_defn( + minimal_header, 10, test_identifier, flags, minimal_typeid), InvalidArgumentError); //Invalid key + EXPECT_THROW(PlainMapSTypeDefn plain_map = TypeObjectUtils::build_plain_map_s_type_defn( + minimal_header, 10, test_identifier, flags, minimal_indirect_id), InvalidArgumentError); //Invalid key + EXPECT_NO_THROW(PlainMapSTypeDefn plain_map = TypeObjectUtils::build_plain_map_s_type_defn( + minimal_header, 10, test_identifier, flags, minimal_alias_id)); + + EXPECT_THROW(PlainMapSTypeDefn plain_map = TypeObjectUtils::build_plain_map_s_type_defn( + minimal_header, 10, complete_typeid, flags, key_identifier), InvalidArgumentError); + EXPECT_THROW(PlainMapSTypeDefn plain_map = TypeObjectUtils::build_plain_map_s_type_defn( + minimal_header, 10, complete_typeid, flags, complete_typeid), InvalidArgumentError); //Invalid key + EXPECT_THROW(PlainMapSTypeDefn plain_map = TypeObjectUtils::build_plain_map_s_type_defn( + minimal_header, 10, complete_typeid, flags, complete_indirect_id), InvalidArgumentError); //Invalid key + EXPECT_THROW(PlainMapSTypeDefn plain_map = TypeObjectUtils::build_plain_map_s_type_defn( + minimal_header, 10, complete_typeid, flags, complete_alias_id), InvalidArgumentError); + EXPECT_THROW(PlainMapSTypeDefn plain_map = TypeObjectUtils::build_plain_map_s_type_defn( + minimal_header, 10, complete_typeid, flags, minimal_typeid), InvalidArgumentError); //Invalid key + EXPECT_THROW(PlainMapSTypeDefn plain_map = TypeObjectUtils::build_plain_map_s_type_defn( + minimal_header, 10, complete_typeid, flags, minimal_indirect_id), InvalidArgumentError); //Invalid key + EXPECT_THROW(PlainMapSTypeDefn plain_map = TypeObjectUtils::build_plain_map_s_type_defn( + minimal_header, 10, complete_typeid, flags, minimal_alias_id), InvalidArgumentError); + + EXPECT_THROW(PlainMapSTypeDefn plain_map = TypeObjectUtils::build_plain_map_s_type_defn( + minimal_header, 10, complete_indirect_id, flags, key_identifier), InvalidArgumentError); + EXPECT_THROW(PlainMapSTypeDefn plain_map = TypeObjectUtils::build_plain_map_s_type_defn( + minimal_header, 10, complete_indirect_id, flags, complete_typeid), InvalidArgumentError); //Invalid key + EXPECT_THROW(PlainMapSTypeDefn plain_map = TypeObjectUtils::build_plain_map_s_type_defn( + minimal_header, 10, complete_indirect_id, flags, complete_indirect_id), InvalidArgumentError); //Invalid key + EXPECT_THROW(PlainMapSTypeDefn plain_map = TypeObjectUtils::build_plain_map_s_type_defn( + minimal_header, 10, complete_indirect_id, flags, complete_alias_id), InvalidArgumentError); + EXPECT_THROW(PlainMapSTypeDefn plain_map = TypeObjectUtils::build_plain_map_s_type_defn( + minimal_header, 10, complete_indirect_id, flags, minimal_typeid), InvalidArgumentError); //Invalid key + EXPECT_THROW(PlainMapSTypeDefn plain_map = TypeObjectUtils::build_plain_map_s_type_defn( + minimal_header, 10, complete_indirect_id, flags, minimal_indirect_id), InvalidArgumentError); //Invalid key + EXPECT_THROW(PlainMapSTypeDefn plain_map = TypeObjectUtils::build_plain_map_s_type_defn( + minimal_header, 10, complete_indirect_id, flags, minimal_alias_id), InvalidArgumentError); + + EXPECT_THROW(PlainMapSTypeDefn plain_map = TypeObjectUtils::build_plain_map_s_type_defn( + minimal_header, 10, complete_alias_id, flags, key_identifier), InvalidArgumentError); + EXPECT_THROW(PlainMapSTypeDefn plain_map = TypeObjectUtils::build_plain_map_s_type_defn( + minimal_header, 10, complete_alias_id, flags, complete_typeid), InvalidArgumentError); //Invalid key + EXPECT_THROW(PlainMapSTypeDefn plain_map = TypeObjectUtils::build_plain_map_s_type_defn( + minimal_header, 10, complete_alias_id, flags, complete_indirect_id), InvalidArgumentError); //Invalid key + EXPECT_THROW(PlainMapSTypeDefn plain_map = TypeObjectUtils::build_plain_map_s_type_defn( + minimal_header, 10, complete_alias_id, flags, complete_alias_id), InvalidArgumentError); + EXPECT_THROW(PlainMapSTypeDefn plain_map = TypeObjectUtils::build_plain_map_s_type_defn( + minimal_header, 10, complete_alias_id, flags, minimal_typeid), InvalidArgumentError); //Invalid key + EXPECT_THROW(PlainMapSTypeDefn plain_map = TypeObjectUtils::build_plain_map_s_type_defn( + minimal_header, 10, complete_alias_id, flags, minimal_indirect_id), InvalidArgumentError); //Invalid key + EXPECT_THROW(PlainMapSTypeDefn plain_map = TypeObjectUtils::build_plain_map_s_type_defn( + minimal_header, 10, complete_alias_id, flags, minimal_alias_id), InvalidArgumentError); + + EXPECT_NO_THROW(PlainMapSTypeDefn plain_map = TypeObjectUtils::build_plain_map_s_type_defn( + minimal_header, 10, minimal_typeid, flags, key_identifier)); + EXPECT_THROW(PlainMapSTypeDefn plain_map = TypeObjectUtils::build_plain_map_s_type_defn( + minimal_header, 10, minimal_typeid, flags, complete_typeid), InvalidArgumentError); //Invalid key + EXPECT_THROW(PlainMapSTypeDefn plain_map = TypeObjectUtils::build_plain_map_s_type_defn( + minimal_header, 10, minimal_typeid, flags, complete_indirect_id), InvalidArgumentError); //Invalid key + EXPECT_THROW(PlainMapSTypeDefn plain_map = TypeObjectUtils::build_plain_map_s_type_defn( + minimal_header, 10, minimal_typeid, flags, complete_alias_id), InvalidArgumentError); + EXPECT_THROW(PlainMapSTypeDefn plain_map = TypeObjectUtils::build_plain_map_s_type_defn( + minimal_header, 10, minimal_typeid, flags, minimal_typeid), InvalidArgumentError); //Invalid key + EXPECT_THROW(PlainMapSTypeDefn plain_map = TypeObjectUtils::build_plain_map_s_type_defn( + minimal_header, 10, minimal_typeid, flags, minimal_indirect_id), InvalidArgumentError); //Invalid key + EXPECT_NO_THROW(PlainMapSTypeDefn plain_map = TypeObjectUtils::build_plain_map_s_type_defn( + minimal_header, 10, minimal_typeid, flags, minimal_alias_id)); + + EXPECT_NO_THROW(PlainMapSTypeDefn plain_map = TypeObjectUtils::build_plain_map_s_type_defn( + minimal_header, 10, minimal_indirect_id, flags, key_identifier)); + EXPECT_THROW(PlainMapSTypeDefn plain_map = TypeObjectUtils::build_plain_map_s_type_defn( + minimal_header, 10, minimal_indirect_id, flags, complete_typeid), InvalidArgumentError); //Invalid key + EXPECT_THROW(PlainMapSTypeDefn plain_map = TypeObjectUtils::build_plain_map_s_type_defn( + minimal_header, 10, minimal_indirect_id, flags, complete_indirect_id), InvalidArgumentError); //Invalid key + EXPECT_THROW(PlainMapSTypeDefn plain_map = TypeObjectUtils::build_plain_map_s_type_defn( + minimal_header, 10, minimal_indirect_id, flags, complete_alias_id), InvalidArgumentError); + EXPECT_THROW(PlainMapSTypeDefn plain_map = TypeObjectUtils::build_plain_map_s_type_defn( + minimal_header, 10, minimal_indirect_id, flags, minimal_typeid), InvalidArgumentError); //Invalid key + EXPECT_THROW(PlainMapSTypeDefn plain_map = TypeObjectUtils::build_plain_map_s_type_defn( + minimal_header, 10, minimal_indirect_id, flags, minimal_indirect_id), InvalidArgumentError); //Invalid key + EXPECT_NO_THROW(PlainMapSTypeDefn plain_map = TypeObjectUtils::build_plain_map_s_type_defn( + minimal_header, 10, minimal_indirect_id, flags, minimal_alias_id)); + + EXPECT_NO_THROW(PlainMapSTypeDefn plain_map = TypeObjectUtils::build_plain_map_s_type_defn( + minimal_header, 10, minimal_alias_id, flags, key_identifier)); + EXPECT_THROW(PlainMapSTypeDefn plain_map = TypeObjectUtils::build_plain_map_s_type_defn( + minimal_header, 10, minimal_alias_id, flags, complete_typeid), InvalidArgumentError); //Invalid key + EXPECT_THROW(PlainMapSTypeDefn plain_map = TypeObjectUtils::build_plain_map_s_type_defn( + minimal_header, 10, minimal_alias_id, flags, complete_indirect_id), InvalidArgumentError); //Invalid key + EXPECT_THROW(PlainMapSTypeDefn plain_map = TypeObjectUtils::build_plain_map_s_type_defn( + minimal_header, 10, minimal_alias_id, flags, complete_alias_id), InvalidArgumentError); + EXPECT_THROW(PlainMapSTypeDefn plain_map = TypeObjectUtils::build_plain_map_s_type_defn( + minimal_header, 10, minimal_alias_id, flags, minimal_typeid), InvalidArgumentError); //Invalid key + EXPECT_THROW(PlainMapSTypeDefn plain_map = TypeObjectUtils::build_plain_map_s_type_defn( + minimal_header, 10, minimal_alias_id, flags, minimal_indirect_id), InvalidArgumentError); //Invalid key + EXPECT_NO_THROW(PlainMapSTypeDefn plain_map = TypeObjectUtils::build_plain_map_s_type_defn( + minimal_header, 10, minimal_alias_id, flags, minimal_alias_id)); } // Build PlainMapLTypeDefn with inconsistent parameters. @@ -613,45 +974,383 @@ TEST(TypeObjectUtilsTests, build_plain_map_l_type_defn_inconsistencies) EXPECT_NO_THROW(key_identifier->string_sdefn(string_type_def)); EXPECT_NO_THROW(PlainMapLTypeDefn plain_seq = TypeObjectUtils::build_plain_map_l_type_defn( fully_descriptive_header, 1000, test_identifier, flags, key_identifier)); - // Change discriminator to EK_COMPLETE + + + + // Get EK_COMPLETE and EK_MINIMAL TypeIdentifiers register_empty_structure_type_object(); TypeIdentifierPair type_ids; + eprosima::fastcdr::external complete_typeid; + eprosima::fastcdr::external minimal_typeid; DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers("empty_structure", type_ids); if (EK_COMPLETE == type_ids.type_identifier1()._d()) { - test_identifier = eprosima::fastcdr::external(new TypeIdentifier(type_ids.type_identifier1())); + complete_typeid = eprosima::fastcdr::external(new TypeIdentifier(type_ids.type_identifier1())); + minimal_typeid = eprosima::fastcdr::external(new TypeIdentifier(type_ids.type_identifier2())); } else { - test_identifier = eprosima::fastcdr::external(new TypeIdentifier(type_ids.type_identifier2())); + complete_typeid = eprosima::fastcdr::external(new TypeIdentifier(type_ids.type_identifier2())); + minimal_typeid = eprosima::fastcdr::external(new TypeIdentifier(type_ids.type_identifier1())); } - // TypeIdentifier consistent with complete header - EXPECT_NO_THROW(PlainMapLTypeDefn plain_seq = TypeObjectUtils::build_plain_map_l_type_defn( - complete_header, 1000, test_identifier, flags, key_identifier)); - // TypeIdentifier inconsistent with minimal header - EXPECT_THROW(PlainMapLTypeDefn plain_seq = TypeObjectUtils::build_plain_map_l_type_defn( - minimal_header, 1000, test_identifier, flags, key_identifier), InvalidArgumentError); - // TypeIdentifier inconsistent with fully-descriptive header - EXPECT_THROW(PlainMapLTypeDefn plain_seq = TypeObjectUtils::build_plain_map_l_type_defn( - fully_descriptive_header, 1000, test_identifier, flags, key_identifier), InvalidArgumentError); - // Change discriminator to EK_MINIMAL + + register_plain_seq_type_object(complete_typeid); + eprosima::fastcdr::external complete_indirect_id; + eprosima::fastcdr::external minimal_indirect_id; + DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers("plain_sequence", type_ids); if (EK_COMPLETE == type_ids.type_identifier1()._d()) { - test_identifier = eprosima::fastcdr::external(new TypeIdentifier(type_ids.type_identifier2())); + complete_indirect_id = + eprosima::fastcdr::external(new TypeIdentifier(type_ids.type_identifier1())); + minimal_indirect_id = + eprosima::fastcdr::external(new TypeIdentifier(type_ids.type_identifier2())); } else { - test_identifier = eprosima::fastcdr::external(new TypeIdentifier(type_ids.type_identifier1())); + complete_indirect_id = + eprosima::fastcdr::external(new TypeIdentifier(type_ids.type_identifier2())); + minimal_indirect_id = + eprosima::fastcdr::external(new TypeIdentifier(type_ids.type_identifier1())); } - // TypeIdentifier inconsistent with complete header - EXPECT_THROW(PlainMapLTypeDefn plain_seq = TypeObjectUtils::build_plain_map_l_type_defn( + + register_alias_type_object(); + eprosima::fastcdr::external complete_alias_id; + eprosima::fastcdr::external minimal_alias_id; + DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers("int16_alias", type_ids); + if (EK_COMPLETE == type_ids.type_identifier1()._d()) + { + complete_alias_id = + eprosima::fastcdr::external(new TypeIdentifier(type_ids.type_identifier1())); + minimal_alias_id = + eprosima::fastcdr::external(new TypeIdentifier(type_ids.type_identifier2())); + } + else + { + complete_alias_id = + eprosima::fastcdr::external(new TypeIdentifier(type_ids.type_identifier2())); + minimal_alias_id = + eprosima::fastcdr::external(new TypeIdentifier(type_ids.type_identifier1())); + } + + EXPECT_NO_THROW(PlainMapLTypeDefn plain_map = TypeObjectUtils::build_plain_map_l_type_defn( + fully_descriptive_header, 1000, test_identifier, flags, key_identifier)); + EXPECT_THROW(PlainMapLTypeDefn plain_map = TypeObjectUtils::build_plain_map_l_type_defn( + fully_descriptive_header, 1000, test_identifier, flags, complete_typeid), InvalidArgumentError); //Invalid key + EXPECT_THROW(PlainMapLTypeDefn plain_map = TypeObjectUtils::build_plain_map_l_type_defn( + fully_descriptive_header, 1000, test_identifier, flags, complete_indirect_id), InvalidArgumentError); //Invalid key + EXPECT_THROW(PlainMapLTypeDefn plain_map = TypeObjectUtils::build_plain_map_l_type_defn( + fully_descriptive_header, 1000, test_identifier, flags, complete_alias_id), InvalidArgumentError); + EXPECT_THROW(PlainMapLTypeDefn plain_map = TypeObjectUtils::build_plain_map_l_type_defn( + fully_descriptive_header, 1000, test_identifier, flags, minimal_typeid), InvalidArgumentError); //Invalid key + EXPECT_THROW(PlainMapLTypeDefn plain_map = TypeObjectUtils::build_plain_map_l_type_defn( + fully_descriptive_header, 1000, test_identifier, flags, minimal_indirect_id), InvalidArgumentError); //Invalid key + EXPECT_THROW(PlainMapLTypeDefn plain_map = TypeObjectUtils::build_plain_map_l_type_defn( + fully_descriptive_header, 1000, test_identifier, flags, minimal_alias_id), InvalidArgumentError); + + EXPECT_THROW(PlainMapLTypeDefn plain_map = TypeObjectUtils::build_plain_map_l_type_defn( + fully_descriptive_header, 1000, complete_typeid, flags, key_identifier), InvalidArgumentError); + EXPECT_THROW(PlainMapLTypeDefn plain_map = TypeObjectUtils::build_plain_map_l_type_defn( + fully_descriptive_header, 1000, complete_typeid, flags, complete_typeid), InvalidArgumentError); //Invalid key + EXPECT_THROW(PlainMapLTypeDefn plain_map = TypeObjectUtils::build_plain_map_l_type_defn( + fully_descriptive_header, 1000, complete_typeid, flags, complete_indirect_id), InvalidArgumentError); //Invalid key + EXPECT_THROW(PlainMapLTypeDefn plain_map = TypeObjectUtils::build_plain_map_l_type_defn( + fully_descriptive_header, 1000, complete_typeid, flags, complete_alias_id), InvalidArgumentError); + EXPECT_THROW(PlainMapLTypeDefn plain_map = TypeObjectUtils::build_plain_map_l_type_defn( + fully_descriptive_header, 1000, complete_typeid, flags, minimal_typeid), InvalidArgumentError); //Invalid key + EXPECT_THROW(PlainMapLTypeDefn plain_map = TypeObjectUtils::build_plain_map_l_type_defn( + fully_descriptive_header, 1000, complete_typeid, flags, minimal_indirect_id), InvalidArgumentError); //Invalid key + EXPECT_THROW(PlainMapLTypeDefn plain_map = TypeObjectUtils::build_plain_map_l_type_defn( + fully_descriptive_header, 1000, complete_typeid, flags, minimal_alias_id), InvalidArgumentError); + + EXPECT_THROW(PlainMapLTypeDefn plain_map = TypeObjectUtils::build_plain_map_l_type_defn( + fully_descriptive_header, 1000, complete_indirect_id, flags, key_identifier), InvalidArgumentError); + EXPECT_THROW(PlainMapLTypeDefn plain_map = TypeObjectUtils::build_plain_map_l_type_defn( + fully_descriptive_header, 1000, complete_indirect_id, flags, complete_typeid), InvalidArgumentError); //Invalid key + EXPECT_THROW(PlainMapLTypeDefn plain_map = TypeObjectUtils::build_plain_map_l_type_defn( + fully_descriptive_header, 1000, complete_indirect_id, flags, complete_indirect_id), + InvalidArgumentError); //Invalid key + EXPECT_THROW(PlainMapLTypeDefn plain_map = TypeObjectUtils::build_plain_map_l_type_defn( + fully_descriptive_header, 1000, complete_indirect_id, flags, complete_alias_id), InvalidArgumentError); + EXPECT_THROW(PlainMapLTypeDefn plain_map = TypeObjectUtils::build_plain_map_l_type_defn( + fully_descriptive_header, 1000, complete_indirect_id, flags, minimal_typeid), InvalidArgumentError); //Invalid key + EXPECT_THROW(PlainMapLTypeDefn plain_map = TypeObjectUtils::build_plain_map_l_type_defn( + fully_descriptive_header, 1000, complete_indirect_id, flags, minimal_indirect_id), + InvalidArgumentError); //Invalid key + EXPECT_THROW(PlainMapLTypeDefn plain_map = TypeObjectUtils::build_plain_map_l_type_defn( + fully_descriptive_header, 1000, complete_indirect_id, flags, minimal_alias_id), InvalidArgumentError); + + EXPECT_THROW(PlainMapLTypeDefn plain_map = TypeObjectUtils::build_plain_map_l_type_defn( + fully_descriptive_header, 1000, complete_alias_id, flags, key_identifier), InvalidArgumentError); + EXPECT_THROW(PlainMapLTypeDefn plain_map = TypeObjectUtils::build_plain_map_l_type_defn( + fully_descriptive_header, 1000, complete_alias_id, flags, complete_typeid), InvalidArgumentError); //Invalid key + EXPECT_THROW(PlainMapLTypeDefn plain_map = TypeObjectUtils::build_plain_map_l_type_defn( + fully_descriptive_header, 1000, complete_alias_id, flags, complete_indirect_id), InvalidArgumentError); //Invalid key + EXPECT_THROW(PlainMapLTypeDefn plain_map = TypeObjectUtils::build_plain_map_l_type_defn( + fully_descriptive_header, 1000, complete_alias_id, flags, complete_alias_id), InvalidArgumentError); + EXPECT_THROW(PlainMapLTypeDefn plain_map = TypeObjectUtils::build_plain_map_l_type_defn( + fully_descriptive_header, 1000, complete_alias_id, flags, minimal_typeid), InvalidArgumentError); //Invalid key + EXPECT_THROW(PlainMapLTypeDefn plain_map = TypeObjectUtils::build_plain_map_l_type_defn( + fully_descriptive_header, 1000, complete_alias_id, flags, minimal_indirect_id), InvalidArgumentError); //Invalid key + EXPECT_THROW(PlainMapLTypeDefn plain_map = TypeObjectUtils::build_plain_map_l_type_defn( + fully_descriptive_header, 1000, complete_alias_id, flags, minimal_alias_id), InvalidArgumentError); + + EXPECT_THROW(PlainMapLTypeDefn plain_map = TypeObjectUtils::build_plain_map_l_type_defn( + fully_descriptive_header, 1000, minimal_typeid, flags, key_identifier), InvalidArgumentError); + EXPECT_THROW(PlainMapLTypeDefn plain_map = TypeObjectUtils::build_plain_map_l_type_defn( + fully_descriptive_header, 1000, minimal_typeid, flags, complete_typeid), InvalidArgumentError); //Invalid key + EXPECT_THROW(PlainMapLTypeDefn plain_map = TypeObjectUtils::build_plain_map_l_type_defn( + fully_descriptive_header, 1000, minimal_typeid, flags, complete_indirect_id), InvalidArgumentError); //Invalid key + EXPECT_THROW(PlainMapLTypeDefn plain_map = TypeObjectUtils::build_plain_map_l_type_defn( + fully_descriptive_header, 1000, minimal_typeid, flags, complete_alias_id), InvalidArgumentError); + EXPECT_THROW(PlainMapLTypeDefn plain_map = TypeObjectUtils::build_plain_map_l_type_defn( + fully_descriptive_header, 1000, minimal_typeid, flags, minimal_typeid), InvalidArgumentError); //Invalid key + EXPECT_THROW(PlainMapLTypeDefn plain_map = TypeObjectUtils::build_plain_map_l_type_defn( + fully_descriptive_header, 1000, minimal_typeid, flags, minimal_indirect_id), InvalidArgumentError); //Invalid key + EXPECT_THROW(PlainMapLTypeDefn plain_map = TypeObjectUtils::build_plain_map_l_type_defn( + fully_descriptive_header, 1000, minimal_typeid, flags, minimal_alias_id), InvalidArgumentError); + + EXPECT_THROW(PlainMapLTypeDefn plain_map = TypeObjectUtils::build_plain_map_l_type_defn( + fully_descriptive_header, 1000, minimal_indirect_id, flags, key_identifier), InvalidArgumentError); + EXPECT_THROW(PlainMapLTypeDefn plain_map = TypeObjectUtils::build_plain_map_l_type_defn( + fully_descriptive_header, 1000, minimal_indirect_id, flags, complete_typeid), InvalidArgumentError); //Invalid key + EXPECT_THROW(PlainMapLTypeDefn plain_map = TypeObjectUtils::build_plain_map_l_type_defn( + fully_descriptive_header, 1000, minimal_indirect_id, flags, complete_indirect_id), + InvalidArgumentError); //Invalid key + EXPECT_THROW(PlainMapLTypeDefn plain_map = TypeObjectUtils::build_plain_map_l_type_defn( + fully_descriptive_header, 1000, minimal_indirect_id, flags, complete_alias_id), InvalidArgumentError); + EXPECT_THROW(PlainMapLTypeDefn plain_map = TypeObjectUtils::build_plain_map_l_type_defn( + fully_descriptive_header, 1000, minimal_indirect_id, flags, minimal_typeid), InvalidArgumentError); //Invalid key + EXPECT_THROW(PlainMapLTypeDefn plain_map = TypeObjectUtils::build_plain_map_l_type_defn( + fully_descriptive_header, 1000, minimal_indirect_id, flags, minimal_indirect_id), InvalidArgumentError); //Invalid key + EXPECT_THROW(PlainMapLTypeDefn plain_map = TypeObjectUtils::build_plain_map_l_type_defn( + fully_descriptive_header, 1000, minimal_indirect_id, flags, minimal_alias_id), InvalidArgumentError); + + EXPECT_THROW(PlainMapLTypeDefn plain_map = TypeObjectUtils::build_plain_map_l_type_defn( + fully_descriptive_header, 1000, minimal_alias_id, flags, key_identifier), InvalidArgumentError); + EXPECT_THROW(PlainMapLTypeDefn plain_map = TypeObjectUtils::build_plain_map_l_type_defn( + fully_descriptive_header, 1000, minimal_alias_id, flags, complete_typeid), InvalidArgumentError); //Invalid key + EXPECT_THROW(PlainMapLTypeDefn plain_map = TypeObjectUtils::build_plain_map_l_type_defn( + fully_descriptive_header, 1000, minimal_alias_id, flags, complete_indirect_id), InvalidArgumentError); //Invalid key + EXPECT_THROW(PlainMapLTypeDefn plain_map = TypeObjectUtils::build_plain_map_l_type_defn( + fully_descriptive_header, 1000, minimal_alias_id, flags, complete_alias_id), InvalidArgumentError); + EXPECT_THROW(PlainMapLTypeDefn plain_map = TypeObjectUtils::build_plain_map_l_type_defn( + fully_descriptive_header, 1000, minimal_alias_id, flags, minimal_typeid), InvalidArgumentError); //Invalid key + EXPECT_THROW(PlainMapLTypeDefn plain_map = TypeObjectUtils::build_plain_map_l_type_defn( + fully_descriptive_header, 1000, minimal_alias_id, flags, minimal_indirect_id), InvalidArgumentError); //Invalid key + EXPECT_THROW(PlainMapLTypeDefn plain_map = TypeObjectUtils::build_plain_map_l_type_defn( + fully_descriptive_header, 1000, minimal_alias_id, flags, minimal_alias_id), InvalidArgumentError); + + + EXPECT_THROW(PlainMapLTypeDefn plain_map = TypeObjectUtils::build_plain_map_l_type_defn( complete_header, 1000, test_identifier, flags, key_identifier), InvalidArgumentError); - // TypeIdentifier consistent with minimal header - EXPECT_NO_THROW(PlainMapLTypeDefn plain_seq = TypeObjectUtils::build_plain_map_l_type_defn( - minimal_header, 1000, test_identifier, flags, key_identifier)); - // TypeIdentifier inconsistent with fully-descriptive header - EXPECT_THROW(PlainMapLTypeDefn plain_seq = TypeObjectUtils::build_plain_map_l_type_defn( - fully_descriptive_header, 1000, test_identifier, flags, key_identifier), InvalidArgumentError); + EXPECT_THROW(PlainMapLTypeDefn plain_map = TypeObjectUtils::build_plain_map_l_type_defn( + complete_header, 1000, test_identifier, flags, complete_typeid), InvalidArgumentError); //Invalid key/// + EXPECT_THROW(PlainMapLTypeDefn plain_map = TypeObjectUtils::build_plain_map_l_type_defn( + complete_header, 1000, test_identifier, flags, complete_indirect_id), InvalidArgumentError); //Invalid key/// + EXPECT_NO_THROW(PlainMapLTypeDefn plain_map = TypeObjectUtils::build_plain_map_l_type_defn( + complete_header, 1000, test_identifier, flags, complete_alias_id)); + EXPECT_THROW(PlainMapLTypeDefn plain_map = TypeObjectUtils::build_plain_map_l_type_defn( + complete_header, 1000, test_identifier, flags, minimal_typeid), InvalidArgumentError); //Invalid key + EXPECT_THROW(PlainMapLTypeDefn plain_map = TypeObjectUtils::build_plain_map_l_type_defn( + complete_header, 1000, test_identifier, flags, minimal_indirect_id), InvalidArgumentError); //Invalid key + EXPECT_THROW(PlainMapLTypeDefn plain_map = TypeObjectUtils::build_plain_map_l_type_defn( + complete_header, 1000, test_identifier, flags, minimal_alias_id), InvalidArgumentError); + + EXPECT_NO_THROW(PlainMapLTypeDefn plain_map = TypeObjectUtils::build_plain_map_l_type_defn( + complete_header, 1000, complete_typeid, flags, key_identifier)); + EXPECT_THROW(PlainMapLTypeDefn plain_map = TypeObjectUtils::build_plain_map_l_type_defn( + complete_header, 1000, complete_typeid, flags, complete_typeid), InvalidArgumentError); //Invalid key + EXPECT_THROW(PlainMapLTypeDefn plain_map = TypeObjectUtils::build_plain_map_l_type_defn( + complete_header, 1000, complete_typeid, flags, complete_indirect_id), InvalidArgumentError); //Invalid key + EXPECT_NO_THROW(PlainMapLTypeDefn plain_map = TypeObjectUtils::build_plain_map_l_type_defn( + complete_header, 1000, complete_typeid, flags, complete_alias_id)); + EXPECT_THROW(PlainMapLTypeDefn plain_map = TypeObjectUtils::build_plain_map_l_type_defn( + complete_header, 1000, complete_typeid, flags, minimal_typeid), InvalidArgumentError); //Invalid key + EXPECT_THROW(PlainMapLTypeDefn plain_map = TypeObjectUtils::build_plain_map_l_type_defn( + complete_header, 1000, complete_typeid, flags, minimal_indirect_id), InvalidArgumentError); //Invalid key + EXPECT_THROW(PlainMapLTypeDefn plain_map = TypeObjectUtils::build_plain_map_l_type_defn( + complete_header, 1000, complete_typeid, flags, minimal_alias_id), InvalidArgumentError); + + EXPECT_NO_THROW(PlainMapLTypeDefn plain_map = TypeObjectUtils::build_plain_map_l_type_defn( + complete_header, 1000, complete_indirect_id, flags, key_identifier)); + EXPECT_THROW(PlainMapLTypeDefn plain_map = TypeObjectUtils::build_plain_map_l_type_defn( + complete_header, 1000, complete_indirect_id, flags, complete_typeid), InvalidArgumentError); //Invalid key + EXPECT_THROW(PlainMapLTypeDefn plain_map = TypeObjectUtils::build_plain_map_l_type_defn( + complete_header, 1000, complete_indirect_id, flags, complete_indirect_id), InvalidArgumentError); //Invalid key + EXPECT_NO_THROW(PlainMapLTypeDefn plain_map = TypeObjectUtils::build_plain_map_l_type_defn( + complete_header, 1000, complete_indirect_id, flags, complete_alias_id)); + EXPECT_THROW(PlainMapLTypeDefn plain_map = TypeObjectUtils::build_plain_map_l_type_defn( + complete_header, 1000, complete_indirect_id, flags, minimal_typeid), InvalidArgumentError); //Invalid key + EXPECT_THROW(PlainMapLTypeDefn plain_map = TypeObjectUtils::build_plain_map_l_type_defn( + complete_header, 1000, complete_indirect_id, flags, minimal_indirect_id), InvalidArgumentError); //Invalid key + EXPECT_THROW(PlainMapLTypeDefn plain_map = TypeObjectUtils::build_plain_map_l_type_defn( + complete_header, 1000, complete_indirect_id, flags, minimal_alias_id), InvalidArgumentError); + + EXPECT_NO_THROW(PlainMapLTypeDefn plain_map = TypeObjectUtils::build_plain_map_l_type_defn( + complete_header, 1000, complete_alias_id, flags, key_identifier)); + EXPECT_THROW(PlainMapLTypeDefn plain_map = TypeObjectUtils::build_plain_map_l_type_defn( + complete_header, 1000, complete_alias_id, flags, complete_typeid), InvalidArgumentError); //Invalid key + EXPECT_THROW(PlainMapLTypeDefn plain_map = TypeObjectUtils::build_plain_map_l_type_defn( + complete_header, 1000, complete_alias_id, flags, complete_indirect_id), InvalidArgumentError); //Invalid key + EXPECT_NO_THROW(PlainMapLTypeDefn plain_map = TypeObjectUtils::build_plain_map_l_type_defn( + complete_header, 1000, complete_alias_id, flags, complete_alias_id)); + EXPECT_THROW(PlainMapLTypeDefn plain_map = TypeObjectUtils::build_plain_map_l_type_defn( + complete_header, 1000, complete_alias_id, flags, minimal_typeid), InvalidArgumentError); //Invalid key + EXPECT_THROW(PlainMapLTypeDefn plain_map = TypeObjectUtils::build_plain_map_l_type_defn( + complete_header, 1000, complete_alias_id, flags, minimal_indirect_id), InvalidArgumentError); //Invalid key + EXPECT_THROW(PlainMapLTypeDefn plain_map = TypeObjectUtils::build_plain_map_l_type_defn( + complete_header, 1000, complete_alias_id, flags, minimal_alias_id), InvalidArgumentError); + + EXPECT_THROW(PlainMapLTypeDefn plain_map = TypeObjectUtils::build_plain_map_l_type_defn( + complete_header, 1000, minimal_typeid, flags, key_identifier), InvalidArgumentError); + EXPECT_THROW(PlainMapLTypeDefn plain_map = TypeObjectUtils::build_plain_map_l_type_defn( + complete_header, 1000, minimal_typeid, flags, complete_typeid), InvalidArgumentError); //Invalid key + EXPECT_THROW(PlainMapLTypeDefn plain_map = TypeObjectUtils::build_plain_map_l_type_defn( + complete_header, 1000, minimal_typeid, flags, complete_indirect_id), InvalidArgumentError); //Invalid key + EXPECT_THROW(PlainMapLTypeDefn plain_map = TypeObjectUtils::build_plain_map_l_type_defn( + complete_header, 1000, minimal_typeid, flags, complete_alias_id), InvalidArgumentError); + EXPECT_THROW(PlainMapLTypeDefn plain_map = TypeObjectUtils::build_plain_map_l_type_defn( + complete_header, 1000, minimal_typeid, flags, minimal_typeid), InvalidArgumentError); //Invalid key + EXPECT_THROW(PlainMapLTypeDefn plain_map = TypeObjectUtils::build_plain_map_l_type_defn( + complete_header, 1000, minimal_typeid, flags, minimal_indirect_id), InvalidArgumentError); //Invalid key + EXPECT_THROW(PlainMapLTypeDefn plain_map = TypeObjectUtils::build_plain_map_l_type_defn( + complete_header, 1000, minimal_typeid, flags, minimal_alias_id), InvalidArgumentError); + + EXPECT_THROW(PlainMapLTypeDefn plain_map = TypeObjectUtils::build_plain_map_l_type_defn( + complete_header, 1000, minimal_indirect_id, flags, key_identifier), InvalidArgumentError); + EXPECT_THROW(PlainMapLTypeDefn plain_map = TypeObjectUtils::build_plain_map_l_type_defn( + complete_header, 1000, minimal_indirect_id, flags, complete_typeid), InvalidArgumentError); //Invalid key + EXPECT_THROW(PlainMapLTypeDefn plain_map = TypeObjectUtils::build_plain_map_l_type_defn( + complete_header, 1000, minimal_indirect_id, flags, complete_indirect_id), InvalidArgumentError); //Invalid key + EXPECT_THROW(PlainMapLTypeDefn plain_map = TypeObjectUtils::build_plain_map_l_type_defn( + complete_header, 1000, minimal_indirect_id, flags, complete_alias_id), InvalidArgumentError); + EXPECT_THROW(PlainMapLTypeDefn plain_map = TypeObjectUtils::build_plain_map_l_type_defn( + complete_header, 1000, minimal_indirect_id, flags, minimal_typeid), InvalidArgumentError); //Invalid key + EXPECT_THROW(PlainMapLTypeDefn plain_map = TypeObjectUtils::build_plain_map_l_type_defn( + complete_header, 1000, minimal_indirect_id, flags, minimal_indirect_id), InvalidArgumentError); //Invalid key + EXPECT_THROW(PlainMapLTypeDefn plain_map = TypeObjectUtils::build_plain_map_l_type_defn( + complete_header, 1000, minimal_indirect_id, flags, minimal_alias_id), InvalidArgumentError); + + EXPECT_THROW(PlainMapLTypeDefn plain_map = TypeObjectUtils::build_plain_map_l_type_defn( + complete_header, 1000, minimal_alias_id, flags, key_identifier), InvalidArgumentError); + EXPECT_THROW(PlainMapLTypeDefn plain_map = TypeObjectUtils::build_plain_map_l_type_defn( + complete_header, 1000, minimal_alias_id, flags, complete_typeid), InvalidArgumentError); //Invalid key + EXPECT_THROW(PlainMapLTypeDefn plain_map = TypeObjectUtils::build_plain_map_l_type_defn( + complete_header, 1000, minimal_alias_id, flags, complete_indirect_id), InvalidArgumentError); //Invalid key + EXPECT_THROW(PlainMapLTypeDefn plain_map = TypeObjectUtils::build_plain_map_l_type_defn( + complete_header, 1000, minimal_alias_id, flags, complete_alias_id), InvalidArgumentError); + EXPECT_THROW(PlainMapLTypeDefn plain_map = TypeObjectUtils::build_plain_map_l_type_defn( + complete_header, 1000, minimal_alias_id, flags, minimal_typeid), InvalidArgumentError); //Invalid key + EXPECT_THROW(PlainMapLTypeDefn plain_map = TypeObjectUtils::build_plain_map_l_type_defn( + complete_header, 1000, minimal_alias_id, flags, minimal_indirect_id), InvalidArgumentError); //Invalid key + EXPECT_THROW(PlainMapLTypeDefn plain_map = TypeObjectUtils::build_plain_map_l_type_defn( + complete_header, 1000, minimal_alias_id, flags, minimal_alias_id), InvalidArgumentError); + + + EXPECT_THROW(PlainMapLTypeDefn plain_map = TypeObjectUtils::build_plain_map_l_type_defn( + minimal_header, 1000, test_identifier, flags, key_identifier), InvalidArgumentError); + EXPECT_THROW(PlainMapLTypeDefn plain_map = TypeObjectUtils::build_plain_map_l_type_defn( + minimal_header, 1000, test_identifier, flags, complete_typeid), InvalidArgumentError); //Invalid key + EXPECT_THROW(PlainMapLTypeDefn plain_map = TypeObjectUtils::build_plain_map_l_type_defn( + minimal_header, 1000, test_identifier, flags, complete_indirect_id), InvalidArgumentError); //Invalid key + EXPECT_THROW(PlainMapLTypeDefn plain_map = TypeObjectUtils::build_plain_map_l_type_defn( + minimal_header, 1000, test_identifier, flags, complete_alias_id), InvalidArgumentError); + EXPECT_THROW(PlainMapLTypeDefn plain_map = TypeObjectUtils::build_plain_map_l_type_defn( + minimal_header, 1000, test_identifier, flags, minimal_typeid), InvalidArgumentError); //Invalid key + EXPECT_THROW(PlainMapLTypeDefn plain_map = TypeObjectUtils::build_plain_map_l_type_defn( + minimal_header, 1000, test_identifier, flags, minimal_indirect_id), InvalidArgumentError); //Invalid key + EXPECT_NO_THROW(PlainMapLTypeDefn plain_map = TypeObjectUtils::build_plain_map_l_type_defn( + minimal_header, 1000, test_identifier, flags, minimal_alias_id)); + + EXPECT_THROW(PlainMapLTypeDefn plain_map = TypeObjectUtils::build_plain_map_l_type_defn( + minimal_header, 1000, complete_typeid, flags, key_identifier), InvalidArgumentError); + EXPECT_THROW(PlainMapLTypeDefn plain_map = TypeObjectUtils::build_plain_map_l_type_defn( + minimal_header, 1000, complete_typeid, flags, complete_typeid), InvalidArgumentError); //Invalid key + EXPECT_THROW(PlainMapLTypeDefn plain_map = TypeObjectUtils::build_plain_map_l_type_defn( + minimal_header, 1000, complete_typeid, flags, complete_indirect_id), InvalidArgumentError); //Invalid key + EXPECT_THROW(PlainMapLTypeDefn plain_map = TypeObjectUtils::build_plain_map_l_type_defn( + minimal_header, 1000, complete_typeid, flags, complete_alias_id), InvalidArgumentError); + EXPECT_THROW(PlainMapLTypeDefn plain_map = TypeObjectUtils::build_plain_map_l_type_defn( + minimal_header, 1000, complete_typeid, flags, minimal_typeid), InvalidArgumentError); //Invalid key + EXPECT_THROW(PlainMapLTypeDefn plain_map = TypeObjectUtils::build_plain_map_l_type_defn( + minimal_header, 1000, complete_typeid, flags, minimal_indirect_id), InvalidArgumentError); //Invalid key + EXPECT_THROW(PlainMapLTypeDefn plain_map = TypeObjectUtils::build_plain_map_l_type_defn( + minimal_header, 1000, complete_typeid, flags, minimal_alias_id), InvalidArgumentError); + + EXPECT_THROW(PlainMapLTypeDefn plain_map = TypeObjectUtils::build_plain_map_l_type_defn( + minimal_header, 1000, complete_indirect_id, flags, key_identifier), InvalidArgumentError); + EXPECT_THROW(PlainMapLTypeDefn plain_map = TypeObjectUtils::build_plain_map_l_type_defn( + minimal_header, 1000, complete_indirect_id, flags, complete_typeid), InvalidArgumentError); //Invalid key + EXPECT_THROW(PlainMapLTypeDefn plain_map = TypeObjectUtils::build_plain_map_l_type_defn( + minimal_header, 1000, complete_indirect_id, flags, complete_indirect_id), InvalidArgumentError); //Invalid key + EXPECT_THROW(PlainMapLTypeDefn plain_map = TypeObjectUtils::build_plain_map_l_type_defn( + minimal_header, 1000, complete_indirect_id, flags, complete_alias_id), InvalidArgumentError); + EXPECT_THROW(PlainMapLTypeDefn plain_map = TypeObjectUtils::build_plain_map_l_type_defn( + minimal_header, 1000, complete_indirect_id, flags, minimal_typeid), InvalidArgumentError); //Invalid key + EXPECT_THROW(PlainMapLTypeDefn plain_map = TypeObjectUtils::build_plain_map_l_type_defn( + minimal_header, 1000, complete_indirect_id, flags, minimal_indirect_id), InvalidArgumentError); //Invalid key + EXPECT_THROW(PlainMapLTypeDefn plain_map = TypeObjectUtils::build_plain_map_l_type_defn( + minimal_header, 1000, complete_indirect_id, flags, minimal_alias_id), InvalidArgumentError); + + EXPECT_THROW(PlainMapLTypeDefn plain_map = TypeObjectUtils::build_plain_map_l_type_defn( + minimal_header, 1000, complete_alias_id, flags, key_identifier), InvalidArgumentError); + EXPECT_THROW(PlainMapLTypeDefn plain_map = TypeObjectUtils::build_plain_map_l_type_defn( + minimal_header, 1000, complete_alias_id, flags, complete_typeid), InvalidArgumentError); //Invalid key + EXPECT_THROW(PlainMapLTypeDefn plain_map = TypeObjectUtils::build_plain_map_l_type_defn( + minimal_header, 1000, complete_alias_id, flags, complete_indirect_id), InvalidArgumentError); //Invalid key + EXPECT_THROW(PlainMapLTypeDefn plain_map = TypeObjectUtils::build_plain_map_l_type_defn( + minimal_header, 1000, complete_alias_id, flags, complete_alias_id), InvalidArgumentError); + EXPECT_THROW(PlainMapLTypeDefn plain_map = TypeObjectUtils::build_plain_map_l_type_defn( + minimal_header, 1000, complete_alias_id, flags, minimal_typeid), InvalidArgumentError); //Invalid key + EXPECT_THROW(PlainMapLTypeDefn plain_map = TypeObjectUtils::build_plain_map_l_type_defn( + minimal_header, 1000, complete_alias_id, flags, minimal_indirect_id), InvalidArgumentError); //Invalid key + EXPECT_THROW(PlainMapLTypeDefn plain_map = TypeObjectUtils::build_plain_map_l_type_defn( + minimal_header, 1000, complete_alias_id, flags, minimal_alias_id), InvalidArgumentError); + + EXPECT_NO_THROW(PlainMapLTypeDefn plain_map = TypeObjectUtils::build_plain_map_l_type_defn( + minimal_header, 1000, minimal_typeid, flags, key_identifier)); + EXPECT_THROW(PlainMapLTypeDefn plain_map = TypeObjectUtils::build_plain_map_l_type_defn( + minimal_header, 1000, minimal_typeid, flags, complete_typeid), InvalidArgumentError); //Invalid key + EXPECT_THROW(PlainMapLTypeDefn plain_map = TypeObjectUtils::build_plain_map_l_type_defn( + minimal_header, 1000, minimal_typeid, flags, complete_indirect_id), InvalidArgumentError); //Invalid key + EXPECT_THROW(PlainMapLTypeDefn plain_map = TypeObjectUtils::build_plain_map_l_type_defn( + minimal_header, 1000, minimal_typeid, flags, complete_alias_id), InvalidArgumentError); + EXPECT_THROW(PlainMapLTypeDefn plain_map = TypeObjectUtils::build_plain_map_l_type_defn( + minimal_header, 1000, minimal_typeid, flags, minimal_typeid), InvalidArgumentError); //Invalid key + EXPECT_THROW(PlainMapLTypeDefn plain_map = TypeObjectUtils::build_plain_map_l_type_defn( + minimal_header, 1000, minimal_typeid, flags, minimal_indirect_id), InvalidArgumentError); //Invalid key + EXPECT_NO_THROW(PlainMapLTypeDefn plain_map = TypeObjectUtils::build_plain_map_l_type_defn( + minimal_header, 1000, minimal_typeid, flags, minimal_alias_id)); + + EXPECT_NO_THROW(PlainMapLTypeDefn plain_map = TypeObjectUtils::build_plain_map_l_type_defn( + minimal_header, 1000, minimal_indirect_id, flags, key_identifier)); + EXPECT_THROW(PlainMapLTypeDefn plain_map = TypeObjectUtils::build_plain_map_l_type_defn( + minimal_header, 1000, minimal_indirect_id, flags, complete_typeid), InvalidArgumentError); //Invalid key + EXPECT_THROW(PlainMapLTypeDefn plain_map = TypeObjectUtils::build_plain_map_l_type_defn( + minimal_header, 1000, minimal_indirect_id, flags, complete_indirect_id), InvalidArgumentError); //Invalid key + EXPECT_THROW(PlainMapLTypeDefn plain_map = TypeObjectUtils::build_plain_map_l_type_defn( + minimal_header, 1000, minimal_indirect_id, flags, complete_alias_id), InvalidArgumentError); + EXPECT_THROW(PlainMapLTypeDefn plain_map = TypeObjectUtils::build_plain_map_l_type_defn( + minimal_header, 1000, minimal_indirect_id, flags, minimal_typeid), InvalidArgumentError); //Invalid key + EXPECT_THROW(PlainMapLTypeDefn plain_map = TypeObjectUtils::build_plain_map_l_type_defn( + minimal_header, 1000, minimal_indirect_id, flags, minimal_indirect_id), InvalidArgumentError); //Invalid key + EXPECT_NO_THROW(PlainMapLTypeDefn plain_map = TypeObjectUtils::build_plain_map_l_type_defn( + minimal_header, 1000, minimal_indirect_id, flags, minimal_alias_id)); + + EXPECT_NO_THROW(PlainMapLTypeDefn plain_map = TypeObjectUtils::build_plain_map_l_type_defn( + minimal_header, 1000, minimal_alias_id, flags, key_identifier)); + EXPECT_THROW(PlainMapLTypeDefn plain_map = TypeObjectUtils::build_plain_map_l_type_defn( + minimal_header, 1000, minimal_alias_id, flags, complete_typeid), InvalidArgumentError); //Invalid key + EXPECT_THROW(PlainMapLTypeDefn plain_map = TypeObjectUtils::build_plain_map_l_type_defn( + minimal_header, 1000, minimal_alias_id, flags, complete_indirect_id), InvalidArgumentError); //Invalid key + EXPECT_THROW(PlainMapLTypeDefn plain_map = TypeObjectUtils::build_plain_map_l_type_defn( + minimal_header, 1000, minimal_alias_id, flags, complete_alias_id), InvalidArgumentError); + EXPECT_THROW(PlainMapLTypeDefn plain_map = TypeObjectUtils::build_plain_map_l_type_defn( + minimal_header, 1000, minimal_alias_id, flags, minimal_typeid), InvalidArgumentError); //Invalid key + EXPECT_THROW(PlainMapLTypeDefn plain_map = TypeObjectUtils::build_plain_map_l_type_defn( + minimal_header, 1000, minimal_alias_id, flags, minimal_indirect_id), InvalidArgumentError); //Invalid key + EXPECT_NO_THROW(PlainMapLTypeDefn plain_map = TypeObjectUtils::build_plain_map_l_type_defn( + minimal_header, 1000, minimal_alias_id, flags, minimal_alias_id)); } // Register small string/wstring. This test does not check member consistency (only checked in Debug build mode).