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

Function test_generic_mappings

tests/basic/test-mappings.cpp:69–116  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

67}
68
69void test_generic_mappings()
70{
71 geode::GenericMapping< geode::index_t, double > generic;
72 generic.map( 0, 42.1 );
73 geode::OpenGeodeBasicException::test( generic.has_mapping_input( 0 ),
74 "0 should be a key for generic inputs" );
75 geode::OpenGeodeBasicException::test( generic.has_mapping_output( 42.1 ),
76 "42.1 should be a key for generic outputs" );
77 generic.map( 1, -22 );
78 geode::OpenGeodeBasicException::test( generic.has_mapping_input( 1 ),
79 "1 should be a key for generic inputs" );
80 geode::OpenGeodeBasicException::test( generic.has_mapping_output( -22 ),
81 "-22 should be a key for generic outputs" );
82 geode::OpenGeodeBasicException::test(
83 generic.size_in() == 2, "Size in of generic should be 2" );
84 geode::OpenGeodeBasicException::test(
85 generic.size_out() == 2, "Size out of generic should be 2" );
86 generic.map( 7, 42.1 );
87 geode::OpenGeodeBasicException::test(
88 generic.size_in() == 3, "Size in of generic should be 3" );
89 geode::OpenGeodeBasicException::test(
90 generic.size_out() == 2, "Size out of generic should still be 2" );
91 geode::OpenGeodeBasicException::test( generic.has_mapping_input( 7 ),
92 "7 should be a key for generic inputs" );
93 geode::OpenGeodeBasicException::test( generic.has_mapping_input( 1 ),
94 "1 should still be a key for generic inputs anymore" );
95 generic.erase_out( 42.1 );
96 geode::OpenGeodeBasicException::test( !generic.has_mapping_output( 42.1 ),
97 "42.1 should not be a key for generic outputs anymore" );
98 geode::OpenGeodeBasicException::test( !generic.has_mapping_input( 0 ),
99 "0 should not be a key for generic inputs anymore" );
100 geode::OpenGeodeBasicException::test( !generic.has_mapping_input( 7 ),
101 "7 should not be a key for generic inputs anymore" );
102 geode::OpenGeodeBasicException::test(
103 generic.size_in() == 1, "Size in of generic should be 1" );
104 geode::OpenGeodeBasicException::test(
105 generic.size_out() == 1, "Size out of generic should be 1" );
106 generic.map( 0, -8.0 );
107 generic.map( 0, -8.0 );
108 generic.map( 0, -8.0 );
109 generic.map( 0, -8.0 );
110 generic.map( 5, -8.0 );
111 geode::OpenGeodeBasicException::test( generic.out2in( -8.0 ).size() == 2,
112 "Size of out2in for -8.0 should be 2" );
113 generic.erase_in( 0 );
114 geode::OpenGeodeBasicException::test( generic.out2in( -8.0 ).size() == 1,
115 "Size of out2in for -8.0 should be 1" );
116}
117
118void test()
119{

Callers 1

testFunction · 0.85

Calls 9

has_mapping_inputMethod · 0.80
has_mapping_outputMethod · 0.80
size_inMethod · 0.80
size_outMethod · 0.80
testFunction · 0.70
mapMethod · 0.45
erase_outMethod · 0.45
sizeMethod · 0.45
erase_inMethod · 0.45

Tested by

no test coverage detected