Skip to content

Commit d3c3347

Browse files
committed
Test alases.idl
Signed-off-by: Yangbo Long <[email protected]>
1 parent 115c2b2 commit d3c3347

File tree

1 file changed

+142
-0
lines changed

1 file changed

+142
-0
lines changed

test/feature/idl_parser/IdlParserTests.cpp

Lines changed: 142 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -363,6 +363,148 @@ TEST_F(IdlParserTests, structures)
363363
// TODO The rest types are skipped since module parsing is not supported.
364364
}
365365

366+
TEST_F(IdlParserTests, aliases)
367+
{
368+
DynamicTypeBuilderFactory::_ref_type factory {DynamicTypeBuilderFactory::get_instance()};
369+
std::vector<std::string> include_paths;
370+
include_paths.push_back("IDL/helpers/basic_inner_types.idl");
371+
372+
DynamicTypeBuilder::_ref_type builder1 = factory->create_type_w_document("IDL/aliases.idl", "AliasInt16", include_paths);
373+
EXPECT_TRUE(builder1);
374+
DynamicType::_ref_type type1 = builder1->build();
375+
ASSERT_TRUE(type1);
376+
DynamicData::_ref_type data1 {DynamicDataFactory::get_instance()->create_data(type1)};
377+
ASSERT_TRUE(data1);
378+
int16_t test1 {0};
379+
EXPECT_EQ(data1->set_int16_value(0, 100), RETCODE_OK);
380+
EXPECT_EQ(data1->get_int16_value(test1, 0), RETCODE_OK);
381+
EXPECT_EQ(test1, 100);
382+
383+
DynamicTypeBuilder::_ref_type builder2 = factory->create_type_w_document("IDL/aliases.idl", "AliasUint16", include_paths);
384+
EXPECT_TRUE(builder2);
385+
DynamicType::_ref_type type2 = builder2->build();
386+
ASSERT_TRUE(type2);
387+
388+
DynamicTypeBuilder::_ref_type builder3 = factory->create_type_w_document("IDL/aliases.idl", "AliasInt32", include_paths);
389+
EXPECT_TRUE(builder3);
390+
DynamicType::_ref_type type3 = builder3->build();
391+
ASSERT_TRUE(type3);
392+
393+
DynamicTypeBuilder::_ref_type builder4 = factory->create_type_w_document("IDL/aliases.idl", "AliasUInt32", include_paths);
394+
EXPECT_TRUE(builder4);
395+
DynamicType::_ref_type type4 = builder4->build();
396+
ASSERT_TRUE(type4);
397+
398+
DynamicTypeBuilder::_ref_type builder5 = factory->create_type_w_document("IDL/aliases.idl", "AliasInt64", include_paths);
399+
EXPECT_TRUE(builder5);
400+
DynamicType::_ref_type type5 = builder5->build();
401+
ASSERT_TRUE(type5);
402+
403+
DynamicTypeBuilder::_ref_type builder6 = factory->create_type_w_document("IDL/aliases.idl", "AliasUInt64", include_paths);
404+
EXPECT_TRUE(builder6);
405+
DynamicType::_ref_type type6 = builder6->build();
406+
ASSERT_TRUE(type6);
407+
408+
DynamicTypeBuilder::_ref_type builder7 = factory->create_type_w_document("IDL/aliases.idl", "AliasFloat32", include_paths);
409+
EXPECT_TRUE(builder7);
410+
DynamicType::_ref_type type7 = builder7->build();
411+
ASSERT_TRUE(type7);
412+
413+
DynamicTypeBuilder::_ref_type builder8 = factory->create_type_w_document("IDL/aliases.idl", "AliasFloat64", include_paths);
414+
EXPECT_TRUE(builder8);
415+
DynamicType::_ref_type type8 = builder8->build();
416+
ASSERT_TRUE(type8);
417+
418+
DynamicTypeBuilder::_ref_type builder9 = factory->create_type_w_document("IDL/aliases.idl", "AliasFloat128", include_paths);
419+
EXPECT_TRUE(builder9);
420+
DynamicType::_ref_type type9 = builder9->build();
421+
ASSERT_TRUE(type9);
422+
423+
DynamicTypeBuilder::_ref_type builder10 = factory->create_type_w_document("IDL/aliases.idl", "AliasBool", include_paths);
424+
EXPECT_TRUE(builder10);
425+
DynamicType::_ref_type type10 = builder10->build();
426+
ASSERT_TRUE(type10);
427+
428+
DynamicTypeBuilder::_ref_type builder11 = factory->create_type_w_document("IDL/aliases.idl", "AliasOctet", include_paths);
429+
EXPECT_TRUE(builder11);
430+
DynamicType::_ref_type type11 = builder11->build();
431+
ASSERT_TRUE(type11);
432+
433+
DynamicTypeBuilder::_ref_type builder12 = factory->create_type_w_document("IDL/aliases.idl", "AliasChar8", include_paths);
434+
EXPECT_TRUE(builder12);
435+
DynamicType::_ref_type type12 = builder12->build();
436+
ASSERT_TRUE(type12);
437+
438+
DynamicTypeBuilder::_ref_type builder13 = factory->create_type_w_document("IDL/aliases.idl", "AliasChar16", include_paths);
439+
EXPECT_TRUE(builder13);
440+
DynamicType::_ref_type type13 = builder13->build();
441+
ASSERT_TRUE(type13);
442+
443+
DynamicTypeBuilder::_ref_type builder14 = factory->create_type_w_document("IDL/aliases.idl", "AliasString8", include_paths);
444+
EXPECT_TRUE(builder14);
445+
DynamicType::_ref_type type14 = builder14->build();
446+
ASSERT_TRUE(type14);
447+
448+
DynamicTypeBuilder::_ref_type builder15 = factory->create_type_w_document("IDL/aliases.idl", "AliasString16", include_paths);
449+
EXPECT_TRUE(builder15);
450+
DynamicType::_ref_type type15 = builder15->build();
451+
ASSERT_TRUE(type15);
452+
453+
DynamicTypeBuilder::_ref_type builder16 = factory->create_type_w_document("IDL/aliases.idl", "AliasEnum", include_paths);
454+
EXPECT_TRUE(builder16);
455+
DynamicType::_ref_type type16 = builder16->build();
456+
ASSERT_TRUE(type16);
457+
458+
// TODO AliasBitmask is skipped since bitmask parsing is not supported.
459+
// DynamicTypeBuilder::_ref_type builder17 = factory->create_type_w_document("IDL/aliases.idl", "AliasBitmask", include_paths);
460+
// EXPECT_TRUE(builder17);
461+
// DynamicType::_ref_type type17 = builder17->build();
462+
// ASSERT_TRUE(type17);
463+
464+
DynamicTypeBuilder::_ref_type builder18 = factory->create_type_w_document("IDL/aliases.idl", "AliasAlias", include_paths);
465+
EXPECT_TRUE(builder18);
466+
DynamicType::_ref_type type18 = builder18->build();
467+
ASSERT_TRUE(type18);
468+
469+
DynamicTypeBuilder::_ref_type builder19 = factory->create_type_w_document("IDL/aliases.idl", "AliasArray", include_paths);
470+
EXPECT_TRUE(builder19);
471+
DynamicType::_ref_type type19 = builder19->build();
472+
ASSERT_TRUE(type19);
473+
474+
DynamicTypeBuilder::_ref_type builder20 = factory->create_type_w_document("IDL/aliases.idl", "AliasMultiArray", include_paths);
475+
EXPECT_TRUE(builder20);
476+
DynamicType::_ref_type type20 = builder20->build();
477+
ASSERT_TRUE(type20);
478+
479+
// TODO AliasSequence is skipped since sequence parsing is not supported.
480+
// DynamicTypeBuilder::_ref_type builder21 = factory->create_type_w_document("IDL/aliases.idl", "AliasSequence", include_paths);
481+
// EXPECT_TRUE(builder21);
482+
// DynamicType::_ref_type type21 = builder21->build();
483+
// ASSERT_TRUE(type21);
484+
485+
// TODO AliasMap is skipped since map parsing is not supported.
486+
// DynamicTypeBuilder::_ref_type builder22 = factory->create_type_w_document("IDL/aliases.idl", "AliasMap", include_paths);
487+
// EXPECT_TRUE(builder22);
488+
// DynamicType::_ref_type type22 = builder22->build();
489+
// ASSERT_TRUE(type22);
490+
491+
DynamicTypeBuilder::_ref_type builder23 = factory->create_type_w_document("IDL/aliases.idl", "AliasUnion", include_paths);
492+
EXPECT_TRUE(builder23);
493+
DynamicType::_ref_type type23 = builder23->build();
494+
ASSERT_TRUE(type23);
495+
496+
DynamicTypeBuilder::_ref_type builder24 = factory->create_type_w_document("IDL/aliases.idl", "AliasStruct", include_paths);
497+
EXPECT_TRUE(builder24);
498+
DynamicType::_ref_type type24 = builder24->build();
499+
ASSERT_TRUE(type24);
500+
501+
// TODO AliasBitset is skipped since bitset parsing is not supported.
502+
// DynamicTypeBuilder::_ref_type builder25 = factory->create_type_w_document("IDL/aliases.idl", "AliasBitset", include_paths);
503+
// EXPECT_TRUE(builder25);
504+
// DynamicType::_ref_type type25 = builder25->build();
505+
// ASSERT_TRUE(type25);
506+
}
507+
366508
int main(
367509
int argc,
368510
char** argv)

0 commit comments

Comments
 (0)