Skip to content

Commit

Permalink
Refs #20733: Add test
Browse files Browse the repository at this point in the history
Signed-off-by: eduponz <eduardoponz@eprosima.com>
  • Loading branch information
EduPonz committed Apr 24, 2024
1 parent ce74d92 commit 4e79d8b
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 0 deletions.
8 changes: 8 additions & 0 deletions test/system/tools/xmlvalidation/XMLTesterExample_profile.xml
Original file line number Diff line number Diff line change
Expand Up @@ -865,6 +865,14 @@
<bit_value name="flag1"/>
</bitmask>
</type>

<type>
<struct name="my_keyed_struct">
<member name="first" type="int32"/>
<member name="second" type="int64"/>
<member name="third" type="int32" key="true"/>
</struct>
</type>
</types>

<library_settings>
Expand Down
8 changes: 8 additions & 0 deletions test/system/tools/xmlvalidation/all_profile.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1107,6 +1107,14 @@
</struct>
</type>

<type>
<struct name="my_keyed_struct">
<member name="first" type="int32"/>
<member name="second" type="int64"/>
<member name="third" type="int32" key="true"/>
</struct>
</type>

<type>
<bitset name="my_bitset_inner">
<bitfield bit_bound="10" name="a" type="int16"/>
Expand Down
8 changes: 8 additions & 0 deletions test/system/tools/xmlvalidation/types_profile.xml
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,14 @@
</struct>
</type>

<type>
<struct name="my_keyed_struct">
<member name="first" type="int32"/>
<member name="second" type="int64"/>
<member name="third" type="int32" key="true"/>
</struct>
</type>

<type>
<bitset name="my_bitset_inner">
<bitfield bit_bound="10" name="a" type="int16"/>
Expand Down
23 changes: 23 additions & 0 deletions test/unittest/dynamic_types/DynamicTypesTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4946,6 +4946,29 @@ TEST_F(DynamicTypesTests, DynamicType_XML_Bitmask_test)
}
}

TEST_F(DynamicTypesTests, DynamicType_XML_key_annotation)
{
using namespace xmlparser;
using namespace types;

XMLP_ret ret = XMLProfileManager::loadXMLFile(DynamicTypesTests::config_file());
ASSERT_EQ(ret, XMLP_ret::XML_OK);

{
DynamicPubSubType* pbType = XMLProfileManager::CreateDynamicPubSubType("BoolStruct");
ASSERT_FALSE(pbType->m_isGetKeyDefined);
XMLProfileManager::DeleteDynamicPubSubType(pbType);
}

{
DynamicPubSubType* pbType = XMLProfileManager::CreateDynamicPubSubType("my_keyed_struct");
ASSERT_TRUE(pbType->m_isGetKeyDefined);
XMLProfileManager::DeleteDynamicPubSubType(pbType);
}

XMLProfileManager::DeleteInstance();
}

TEST(TypeIdentifierTests, MinimalTypeIdentifierComparision)
{
TypeIdentifier enum1 = *GetMyEnumIdentifier(false);
Expand Down
7 changes: 7 additions & 0 deletions test/unittest/dynamic_types/types_profile.xml
Original file line number Diff line number Diff line change
Expand Up @@ -267,4 +267,11 @@
<bit_value name="flag5" position="5"/>
</bitmask>
</type>
<type>
<struct name="my_keyed_struct">
<member name="first" type="int32"/>
<member name="second" type="int64"/>
<member name="third" type="int32" key="true"/>
</struct>
</type>
</types>

0 comments on commit 4e79d8b

Please sign in to comment.