From 401942997bad1436b92a71d8a22b26bcf1400a37 Mon Sep 17 00:00:00 2001 From: adriancampo Date: Tue, 27 Feb 2024 12:43:14 +0100 Subject: [PATCH 1/6] Refs #20533: Fixed tests for member_id of unions. Signed-off-by: adriancampo --- .../fastdds/idl/templates/TypeObjectTestingTestSource.stg | 2 +- thirdparty/idl-parser | 2 +- 2 files changed, 2 insertions(+), 2 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 4f9d2631..f11cc63b 100644 --- a/src/main/java/com/eprosima/fastdds/idl/templates/TypeObjectTestingTestSource.stg +++ b/src/main/java/com/eprosima/fastdds/idl/templates/TypeObjectTestingTestSource.stg @@ -692,7 +692,7 @@ else discriminator_type_ids.type_identifier2() == type_objects.complete_type_object.union_type().discriminator().common().type_id()); } $check_type_detail_annotations(object=union.discriminator, type="union_type().discriminator()")$ -MemberId member_id = 0; +MemberId member_id = 1; $union.members: { member | $check_union_member(member=member, parent=union)$}; separator="\n"$ ASSERT_EQ($union.membersSize$, type_objects.minimal_type_object.union_type().member_seq().size()); for (size_t i = 1; i < type_objects.minimal_type_object.union_type().member_seq().size(); ++i) diff --git a/thirdparty/idl-parser b/thirdparty/idl-parser index 85d9d07a..91ca4907 160000 --- a/thirdparty/idl-parser +++ b/thirdparty/idl-parser @@ -1 +1 @@ -Subproject commit 85d9d07a6fc93600880ef4a8cf2a3daeb6cf5d0b +Subproject commit 91ca49073f7b81e2bd4fe624a0cceb0dad6d634f From b743c857735baa0d5e677655f837b4dd4ffbefe8 Mon Sep 17 00:00:00 2001 From: adriancampo Date: Tue, 27 Feb 2024 19:35:08 +0100 Subject: [PATCH 2/6] Refs #20533: Fix for maps equiv_kind. Signed-off-by: adriancampo --- .../fastdds/idl/templates/XTypesTypeObjectSource.stg | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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 7ca52f4f..e13c6026 100644 --- a/src/main/java/com/eprosima/fastdds/idl/templates/XTypesTypeObjectSource.stg +++ b/src/main/java/com/eprosima/fastdds/idl/templates/XTypesTypeObjectSource.stg @@ -675,13 +675,13 @@ else return; } EquivalenceKind equiv_kind_$map_name(map)$ = EK_BOTH; -if (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()) || (TI_PLAIN_ARRAY_LARGE == element_identifier_$map_name(map)$->_d() && EK_COMPLETE == element_identifier_$map_name(map)$->array_ldefn().header().equiv_kind()) || - (TI_PLAIN_MAP_SMALL == element_identifier_$map_name(map)$->_d() && EK_COMPLETE == element_identifier_$map_name(map)$->map_sdefn().header().equiv_kind()) || - (TI_PLAIN_MAP_LARGE == element_identifier_$map_name(map)$->_d() && EK_COMPLETE == element_identifier_$map_name(map)$->map_ldefn().header().equiv_kind())) + (TI_PLAIN_MAP_SMALL == element_identifier_$map_name(map)$->_d() && (EK_COMPLETE == element_identifier_$map_name(map)$->map_sdefn().key_identifier()->_d() || EK_COMPLETE == element_identifier_$map_name(map)$->map_sdefn().header().equiv_kind())) || + (TI_PLAIN_MAP_LARGE == element_identifier_$map_name(map)$->_d() && (EK_COMPLETE == element_identifier_$map_name(map)$->map_ldefn().key_identifier()->_d() || EK_COMPLETE == element_identifier_$map_name(map)$->map_ldefn().header().equiv_kind()))) { equiv_kind_$map_name(map)$ = EK_COMPLETE; } From 17a0ae4bacb6438492e8762eae34f45bd400c639 Mon Sep 17 00:00:00 2001 From: adriancampo Date: Wed, 28 Feb 2024 11:04:27 +0100 Subject: [PATCH 3/6] 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 f11cc63b..987813b3 100644 --- a/src/main/java/com/eprosima/fastdds/idl/templates/TypeObjectTestingTestSource.stg +++ b/src/main/java/com/eprosima/fastdds/idl/templates/TypeObjectTestingTestSource.stg @@ -1096,8 +1096,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 { @@ -1123,8 +1122,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 { @@ -1181,8 +1179,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 { @@ -1206,8 +1203,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 { @@ -1262,21 +1258,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 { @@ -1323,21 +1306,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()) || From 98ce72b3933cf4f9c0b5daa294c8b90abdb53098 Mon Sep 17 00:00:00 2001 From: adriancampo Date: Wed, 28 Feb 2024 15:41:08 +0100 Subject: [PATCH 4/6] Refs #20533: Updated submodule. Signed-off-by: adriancampo --- thirdparty/idl-parser | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/thirdparty/idl-parser b/thirdparty/idl-parser index 91ca4907..d8fe424c 160000 --- a/thirdparty/idl-parser +++ b/thirdparty/idl-parser @@ -1 +1 @@ -Subproject commit 91ca49073f7b81e2bd4fe624a0cceb0dad6d634f +Subproject commit d8fe424cd74e00781c815cb09139536cb13e5ee6 From bc87e1748161f8e3fa66699a2527ab8b90cc8934 Mon Sep 17 00:00:00 2001 From: adriancampo Date: Sun, 3 Mar 2024 13:14:38 +0100 Subject: [PATCH 5/6] Refs #20533: Added check for id2. Signed-off-by: adriancampo --- .../fastdds/idl/templates/TypeObjectTestingTestSource.stg | 6 ++++++ 1 file changed, 6 insertions(+) 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 987813b3..e71c70ba 100644 --- a/src/main/java/com/eprosima/fastdds/idl/templates/TypeObjectTestingTestSource.stg +++ b/src/main/java/com/eprosima/fastdds/idl/templates/TypeObjectTestingTestSource.stg @@ -1097,6 +1097,7 @@ if (type_ids.type_identifier1()._d() == TI_PLAIN_ARRAY_SMALL) { 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()); + EXPECT_TRUE(element_type_ids.type_identifier2() == TK_NONE); } else { @@ -1123,6 +1124,7 @@ else { 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()); + EXPECT_TRUE(element_type_ids.type_identifier2() == TK_NONE); } else { @@ -1180,6 +1182,7 @@ if (type_ids.type_identifier1()._d() == TI_PLAIN_SEQUENCE_SMALL) { 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()); + EXPECT_TRUE(element_type_ids.type_identifier2() == TK_NONE); } else { @@ -1204,6 +1207,7 @@ else { 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()); + EXPECT_TRUE(element_type_ids.type_identifier2() == TK_NONE); } else { @@ -1260,6 +1264,7 @@ if (type_ids.type_identifier1()._d() == TI_PLAIN_MAP_SMALL) 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()); EXPECT_TRUE(key_type_ids.type_identifier1() == *type_ids.type_identifier1().map_sdefn().key_identifier()); + EXPECT_TRUE(element_type_ids.type_identifier2() == TK_NONE); } else { @@ -1308,6 +1313,7 @@ else 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()); EXPECT_TRUE(key_type_ids.type_identifier1() == *type_ids.type_identifier1().map_ldefn().key_identifier()); + EXPECT_TRUE(element_type_ids.type_identifier2() == TK_NONE); } else { From 40fc4e04394d7e600b868de8c28a36f88e61409a Mon Sep 17 00:00:00 2001 From: adriancampo Date: Mon, 4 Mar 2024 09:49:31 +0100 Subject: [PATCH 6/6] Refs #20533: Added check for TK_NONE keys Signed-off-by: adriancampo --- .../idl/templates/TypeObjectTestingTestSource.stg | 12 ++++++------ 1 file changed, 6 insertions(+), 6 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 e71c70ba..0a1c5e22 100644 --- a/src/main/java/com/eprosima/fastdds/idl/templates/TypeObjectTestingTestSource.stg +++ b/src/main/java/com/eprosima/fastdds/idl/templates/TypeObjectTestingTestSource.stg @@ -1097,7 +1097,7 @@ if (type_ids.type_identifier1()._d() == TI_PLAIN_ARRAY_SMALL) { 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()); - EXPECT_TRUE(element_type_ids.type_identifier2() == TK_NONE); + EXPECT_TRUE(element_type_ids.type_identifier2()._d() == TK_NONE); } else { @@ -1124,7 +1124,7 @@ else { 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()); - EXPECT_TRUE(element_type_ids.type_identifier2() == TK_NONE); + EXPECT_TRUE(element_type_ids.type_identifier2()._d() == TK_NONE); } else { @@ -1182,7 +1182,7 @@ if (type_ids.type_identifier1()._d() == TI_PLAIN_SEQUENCE_SMALL) { 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()); - EXPECT_TRUE(element_type_ids.type_identifier2() == TK_NONE); + EXPECT_TRUE(element_type_ids.type_identifier2()._d() == TK_NONE); } else { @@ -1207,7 +1207,7 @@ else { 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()); - EXPECT_TRUE(element_type_ids.type_identifier2() == TK_NONE); + EXPECT_TRUE(element_type_ids.type_identifier2()._d() == TK_NONE); } else { @@ -1264,7 +1264,7 @@ if (type_ids.type_identifier1()._d() == TI_PLAIN_MAP_SMALL) 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()); EXPECT_TRUE(key_type_ids.type_identifier1() == *type_ids.type_identifier1().map_sdefn().key_identifier()); - EXPECT_TRUE(element_type_ids.type_identifier2() == TK_NONE); + EXPECT_TRUE(element_type_ids.type_identifier2()._d() == TK_NONE && key_type_ids.type_identifier2()._d() == TK_NONE); } else { @@ -1313,7 +1313,7 @@ else 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()); EXPECT_TRUE(key_type_ids.type_identifier1() == *type_ids.type_identifier1().map_ldefn().key_identifier()); - EXPECT_TRUE(element_type_ids.type_identifier2() == TK_NONE); + EXPECT_TRUE(element_type_ids.type_identifier2()._d() == TK_NONE && key_type_ids.type_identifier2()._d() == TK_NONE); } else {