Skip to content

Commit

Permalink
Test structures.idl with proper comments
Browse files Browse the repository at this point in the history
Signed-off-by: Yangbo Long <yangbo.long.mav@gmail.com>
  • Loading branch information
YangboLong committed Oct 12, 2024
1 parent c3a26fe commit 115c2b2
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 9 deletions.
34 changes: 25 additions & 9 deletions src/cpp/fastdds/xtypes/dynamic_types/idl_parser/IdlParser.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1567,11 +1567,11 @@ struct action<annotation_appl>
static void apply(
const Input& in,
Context* /*ctx*/,
std::map<std::string, std::string>& /*state*/,
std::map<std::string, std::string>& state,
std::vector<traits<DynamicData>::ref_type>& /*operands*/)
{
const std::string type = in.string();
EPROSIMA_LOG_INFO(IDLPARSER, "[TODO] annotation_appl parsing not supported: " << type);
state["type"] = in.string();
EPROSIMA_LOG_INFO(IDLPARSER, "[TODO] annotation_appl parsing not supported: " << state["type"]);
}

};
Expand All @@ -1583,11 +1583,11 @@ struct action<bitmask_dcl>
static void apply(
const Input& in,
Context* /*ctx*/,
std::map<std::string, std::string>& /*state*/,
std::map<std::string, std::string>& state,
std::vector<traits<DynamicData>::ref_type>& /*operands*/)
{
const std::string type = in.string();
EPROSIMA_LOG_INFO(IDLPARSER, "[TODO] bitmask_dcl parsing not supported: " << type);
state["type"] = in.string();
EPROSIMA_LOG_INFO(IDLPARSER, "[TODO] bitmask_dcl parsing not supported: " << state["type"]);
}

};
Expand All @@ -1599,11 +1599,27 @@ struct action<bitset_dcl>
static void apply(
const Input& in,
Context* /*ctx*/,
std::map<std::string, std::string>& /*state*/,
std::map<std::string, std::string>& state,
std::vector<traits<DynamicData>::ref_type>& /*operands*/)
{
const std::string type = in.string();
EPROSIMA_LOG_INFO(IDLPARSER, "[TODO] bitset_dcl parsing not supported: " << type);
state["type"] = in.string();
EPROSIMA_LOG_INFO(IDLPARSER, "[TODO] bitset_dcl parsing not supported: " << state["type"]);
}

};

template<>
struct action<module_dcl>
{
template<typename Input>
static void apply(
const Input& in,
Context* /*ctx*/,
std::map<std::string, std::string>& state,
std::vector<traits<DynamicData>::ref_type>& /*operands*/)
{
state["type"] = in.string();
EPROSIMA_LOG_INFO(IDLPARSER, "[TODO] module_dcl parsing not supported: " << state["type"]);
}

};
Expand Down
29 changes: 29 additions & 0 deletions test/feature/idl_parser/IdlParserTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,35 @@ TEST_F(IdlParserTests, structures)
// EXPECT_TRUE(builder23);
// DynamicType::_ref_type type23 = builder23->build();
// ASSERT_TRUE(type23);

DynamicTypeBuilder::_ref_type builder24 = factory->create_type_w_document("IDL/structures.idl", "StructUnion", include_paths);
EXPECT_TRUE(builder24);
DynamicType::_ref_type type24 = builder24->build();
ASSERT_TRUE(type24);

DynamicTypeBuilder::_ref_type builder25 = factory->create_type_w_document("IDL/structures.idl", "StructStructure", include_paths);
EXPECT_TRUE(builder25);
DynamicType::_ref_type type25 = builder25->build();
ASSERT_TRUE(type25);

// TODO StruStructBitsettMap is skipped since bitset parsing is not supported.
// DynamicTypeBuilder::_ref_type builder26 = factory->create_type_w_document("IDL/structures.idl", "StructBitset", include_paths);
// EXPECT_TRUE(builder26);
// DynamicType::_ref_type type26 = builder26->build();
// ASSERT_TRUE(type26);

DynamicTypeBuilder::_ref_type builder27 = factory->create_type_w_document("IDL/structures.idl", "StructEmpty", include_paths);
EXPECT_TRUE(builder27);
DynamicType::_ref_type type27 = builder27->build();
ASSERT_TRUE(type27);

// TODO Structures is skipped since some members parsing is not supported.
// DynamicTypeBuilder::_ref_type builder28 = factory->create_type_w_document("IDL/structures.idl", "Structures", include_paths);
// EXPECT_TRUE(builder28);
// DynamicType::_ref_type type28 = builder28->build();
// ASSERT_TRUE(type28);

// TODO The rest types are skipped since module parsing is not supported.
}

int main(
Expand Down

0 comments on commit 115c2b2

Please sign in to comment.