MCPcopy Create free account
hub / github.com/Geode-solutions/OpenGeode / test_generic_mapping

Function test_generic_mapping

tests/model/test-model-mapping.cpp:70–117  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

68}
69
70void test_generic_mapping()
71{
72 geode::ModelGenericMapping generic_mapping;
73
74 std::vector< geode::uuid > uuids_in( 3 );
75 std::vector< geode::uuid > uuids_out( 3 );
76
77 geode::GenericMapping< geode::uuid > corner_mapping;
78 for( const auto i : geode::LRange{ 3 } )
79 {
80 for( const auto j : geode::Range{ i, 3 } )
81 {
82 corner_mapping.map( uuids_in[i], uuids_out[j] );
83 DEBUG( i );
84 DEBUG( j );
85 DEBUG( "----" );
86 }
87 }
88 generic_mapping.emplace(
89 geode::Corner3D::component_type_static(), std::move( corner_mapping ) );
90 geode::OpenGeodeModelException::test(
91 !generic_mapping.has_mapping_type(
92 geode::Surface3D::component_type_static() ),
93 "Generic mappings should not exist for Surfaces" );
94 geode::OpenGeodeModelException::test(
95 generic_mapping.has_mapping_type(
96 geode::Corner3D::component_type_static() ),
97 "Generic mappings should exist for Corners" );
98 const auto& corner_generic_mappings =
99 generic_mapping.at( geode::Corner3D::component_type_static() );
100 geode::OpenGeodeModelException::test(
101 corner_generic_mappings.size_in() == 3,
102 "Wrong size for CopyMapping Corners in" );
103 geode::OpenGeodeModelException::test(
104 corner_generic_mappings.size_out() == 3,
105 "Wrong size for CopyMapping Corners out" );
106 for( const auto i : geode::LRange{ 3 } )
107 {
108 geode::OpenGeodeModelException::test(
109 corner_generic_mappings.in2out( uuids_in[i] ).size()
110 == static_cast< geode::index_t >( 3 - i ),
111 "Wrong mapping for CopyMapping Corners (in2out)" );
112 geode::OpenGeodeModelException::test(
113 corner_generic_mappings.out2in( uuids_out[i] ).size()
114 == static_cast< geode::index_t >( i + 1 ),
115 "Wrong mapping for CopyMapping Corners (out2in)" );
116 }
117}
118
119void test_components_mapping()
120{

Callers 1

testFunction · 0.85

Calls 8

emplaceMethod · 0.80
has_mapping_typeMethod · 0.80
atMethod · 0.80
size_inMethod · 0.80
size_outMethod · 0.80
testFunction · 0.70
mapMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected