From 9cff98fc3de2761990d9b7b0cf043c6478f54c53 Mon Sep 17 00:00:00 2001 From: adriancampo Date: Wed, 28 Feb 2024 11:04:27 +0100 Subject: [PATCH] Refs #20533: Removed unnecessary checks. Signed-off-by: adriancampo --- .../templates/TypeObjectTestingTestSource.stg | 46 ++++--------------- .../idl/templates/XTypesTypeObjectSource.stg | 2 +- 2 files changed, 9 insertions(+), 39 deletions(-) diff --git a/src/main/java/com/eprosima/fastdds/idl/templates/TypeObjectTestingTestSource.stg b/src/main/java/com/eprosima/fastdds/idl/templates/TypeObjectTestingTestSource.stg index 8de58789..2f288cad 100644 --- a/src/main/java/com/eprosima/fastdds/idl/templates/TypeObjectTestingTestSource.stg +++ b/src/main/java/com/eprosima/fastdds/idl/templates/TypeObjectTestingTestSource.stg @@ -1099,8 +1099,7 @@ if (type_ids.type_identifier1()._d() == TI_PLAIN_ARRAY_SMALL) if (type_ids.type_identifier2()._d() == TK_NONE) { EXPECT_EQ(type_ids.type_identifier1().array_sdefn().header().equiv_kind(), EK_BOTH); - EXPECT_TRUE(element_type_ids.type_identifier1() == *type_ids.type_identifier1().array_sdefn().element_identifier() || - element_type_ids.type_identifier2() == *type_ids.type_identifier1().array_sdefn().element_identifier()); + EXPECT_TRUE(element_type_ids.type_identifier1() == *type_ids.type_identifier1().array_sdefn().element_identifier()); } else { @@ -1126,8 +1125,7 @@ else if (type_ids.type_identifier2()._d() == TK_NONE) { EXPECT_EQ(type_ids.type_identifier1().array_ldefn().header().equiv_kind(), EK_BOTH); - EXPECT_TRUE(element_type_ids.type_identifier1() == *type_ids.type_identifier1().array_ldefn().element_identifier() || - element_type_ids.type_identifier2() == *type_ids.type_identifier1().array_ldefn().element_identifier()); + EXPECT_TRUE(element_type_ids.type_identifier1() == *type_ids.type_identifier1().array_ldefn().element_identifier()); } else { @@ -1184,8 +1182,7 @@ if (type_ids.type_identifier1()._d() == TI_PLAIN_SEQUENCE_SMALL) if (type_ids.type_identifier2()._d() == TK_NONE) { EXPECT_EQ(type_ids.type_identifier1().seq_sdefn().header().equiv_kind(), EK_BOTH); - EXPECT_TRUE(element_type_ids.type_identifier1() == *type_ids.type_identifier1().seq_sdefn().element_identifier() || - element_type_ids.type_identifier2() == *type_ids.type_identifier1().seq_sdefn().element_identifier()); + EXPECT_TRUE(element_type_ids.type_identifier1() == *type_ids.type_identifier1().seq_sdefn().element_identifier()); } else { @@ -1209,8 +1206,7 @@ else if (type_ids.type_identifier2()._d() == TK_NONE) { EXPECT_EQ(type_ids.type_identifier1().seq_ldefn().header().equiv_kind(), EK_BOTH); - EXPECT_TRUE(element_type_ids.type_identifier1() == *type_ids.type_identifier1().seq_ldefn().element_identifier() || - element_type_ids.type_identifier2() == *type_ids.type_identifier1().seq_ldefn().element_identifier()); + EXPECT_TRUE(element_type_ids.type_identifier1() == *type_ids.type_identifier1().seq_ldefn().element_identifier()); } else { @@ -1265,21 +1261,8 @@ if (type_ids.type_identifier1()._d() == TI_PLAIN_MAP_SMALL) if (type_ids.type_identifier2()._d() == TK_NONE) { EXPECT_EQ(type_ids.type_identifier1().map_sdefn().header().equiv_kind(), EK_BOTH); - EXPECT_TRUE(element_type_ids.type_identifier1() == *type_ids.type_identifier1().map_sdefn().element_identifier() || - element_type_ids.type_identifier2() == *type_ids.type_identifier1().map_sdefn().element_identifier()); - EXPECT_TRUE(key_type_ids.type_identifier1() == *type_ids.type_identifier1().map_sdefn().key_identifier() || - key_type_ids.type_identifier2() == *type_ids.type_identifier1().map_sdefn().key_identifier()); - } - else if (EK_BOTH == type_ids.type_identifier1().map_sdefn().header().equiv_kind()) - { - EXPECT_EQ(type_ids.type_identifier1().map_sdefn().header().equiv_kind(), - type_ids.type_identifier2().map_sdefn().header().equiv_kind()); - EXPECT_TRUE(element_type_ids.type_identifier1() == *type_ids.type_identifier1().map_sdefn().element_identifier() || - element_type_ids.type_identifier2() == *type_ids.type_identifier1().map_sdefn().element_identifier()); - EXPECT_TRUE((key_type_ids.type_identifier1() == *type_ids.type_identifier1().map_sdefn().key_identifier() && - key_type_ids.type_identifier2() == *type_ids.type_identifier2().map_sdefn().key_identifier()) || - (key_type_ids.type_identifier1() == *type_ids.type_identifier2().map_sdefn().key_identifier() && - key_type_ids.type_identifier2() == *type_ids.type_identifier1().map_sdefn().key_identifier())); + EXPECT_TRUE(element_type_ids.type_identifier1() == *type_ids.type_identifier1().map_sdefn().element_identifier()); + EXPECT_TRUE(key_type_ids.type_identifier1() == *type_ids.type_identifier1().map_sdefn().key_identifier()); } else { @@ -1326,21 +1309,8 @@ else if (type_ids.type_identifier2()._d() == TK_NONE) { EXPECT_EQ(type_ids.type_identifier1().map_ldefn().header().equiv_kind(), EK_BOTH); - EXPECT_TRUE(element_type_ids.type_identifier1() == *type_ids.type_identifier1().map_ldefn().element_identifier() || - element_type_ids.type_identifier2() == *type_ids.type_identifier1().map_ldefn().element_identifier()); - EXPECT_TRUE(key_type_ids.type_identifier1() == *type_ids.type_identifier1().map_ldefn().key_identifier() || - key_type_ids.type_identifier2() == *type_ids.type_identifier1().map_ldefn().key_identifier()); - } - else if (EK_BOTH == type_ids.type_identifier1().map_ldefn().header().equiv_kind()) - { - EXPECT_EQ(type_ids.type_identifier1().map_ldefn().header().equiv_kind(), - type_ids.type_identifier2().map_ldefn().header().equiv_kind()); - EXPECT_TRUE(element_type_ids.type_identifier1() == *type_ids.type_identifier1().map_ldefn().element_identifier() || - element_type_ids.type_identifier2() == *type_ids.type_identifier1().map_ldefn().element_identifier()); - EXPECT_TRUE((key_type_ids.type_identifier1() == *type_ids.type_identifier1().map_ldefn().key_identifier() && - key_type_ids.type_identifier2() == *type_ids.type_identifier2().map_ldefn().key_identifier()) || - (key_type_ids.type_identifier1() == *type_ids.type_identifier2().map_ldefn().key_identifier() && - key_type_ids.type_identifier2() == *type_ids.type_identifier1().map_ldefn().key_identifier())); + EXPECT_TRUE(element_type_ids.type_identifier1() == *type_ids.type_identifier1().map_ldefn().element_identifier()); + EXPECT_TRUE(key_type_ids.type_identifier1() == *type_ids.type_identifier1().map_ldefn().key_identifier()); } else { diff --git a/src/main/java/com/eprosima/fastdds/idl/templates/XTypesTypeObjectSource.stg b/src/main/java/com/eprosima/fastdds/idl/templates/XTypesTypeObjectSource.stg index e13c6026..3cc60233 100644 --- a/src/main/java/com/eprosima/fastdds/idl/templates/XTypesTypeObjectSource.stg +++ b/src/main/java/com/eprosima/fastdds/idl/templates/XTypesTypeObjectSource.stg @@ -675,7 +675,7 @@ else return; } EquivalenceKind equiv_kind_$map_name(map)$ = EK_BOTH; -if ( (EK_COMPLETE == key_identifier_$map_name(map)$->_d() || EK_COMPLETE == element_identifier_$map_name(map)$->_d()) || +if ((EK_COMPLETE == key_identifier_$map_name(map)$->_d() || EK_COMPLETE == element_identifier_$map_name(map)$->_d()) || (TI_PLAIN_SEQUENCE_SMALL == element_identifier_$map_name(map)$->_d() && EK_COMPLETE == element_identifier_$map_name(map)$->seq_sdefn().header().equiv_kind()) || (TI_PLAIN_SEQUENCE_LARGE == element_identifier_$map_name(map)$->_d() && EK_COMPLETE == element_identifier_$map_name(map)$->seq_ldefn().header().equiv_kind()) || (TI_PLAIN_ARRAY_SMALL == element_identifier_$map_name(map)$->_d() && EK_COMPLETE == element_identifier_$map_name(map)$->array_sdefn().header().equiv_kind()) ||