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

Function test_double_array_attribute

tests/basic/test-attribute.cpp:243–300  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

241}
242
243void test_double_array_attribute( geode::AttributeManager& manager )
244{
245 auto array_attribute =
246 manager.find_or_create_attribute< geode::VariableAttribute,
247 std::array< double, 3 > >(
248 "array_double_3", { { 10., 11., 12. } }, { true, true } );
249 geode::OpenGeodeBasicException::test(
250 array_attribute->default_value()[0] == 10., "Wrong default value" );
251 geode::OpenGeodeBasicException::test(
252 array_attribute->default_value()[1] == 11., "Wrong default value" );
253 geode::OpenGeodeBasicException::test(
254 array_attribute->default_value()[2] == 12., "Wrong default value" );
255 array_attribute->set_value( 3, { { 1., 2., 3. } } );
256 array_attribute->set_value( 7, { { 2., 5., 7. } } );
257 manager.assign_attribute_value( 3, 2 );
258 manager.interpolate_attribute_value( { { 1, 7 }, { 0.5, 0.3 } }, 4 );
259
260 auto attribute =
261 manager.find_attribute< std::array< double, 3 > >( "array_double_3" );
262 geode::OpenGeodeBasicException::test( attribute->value( 2 )[0] == 1.,
263 "Value [2,0] Should be equal to 1., not ", attribute->value( 2 )[0] );
264 geode::OpenGeodeBasicException::test( attribute->value( 2 )[1] == 2.,
265 "Value [2,1] Should be equal to 2., not ", attribute->value( 2 )[1] );
266 geode::OpenGeodeBasicException::test( attribute->value( 2 )[2] == 3.,
267 "Value [2,2] Should be equal to 3., not ", attribute->value( 2 )[2] );
268 geode::OpenGeodeBasicException::test( attribute->value( 3 )[0] == 1.,
269 "Value [3,0] Should be equal to 1., not ", attribute->value( 3 )[0] );
270 geode::OpenGeodeBasicException::test( attribute->value( 3 )[1] == 2.,
271 "Value [3,1] Should be equal to 2., not ", attribute->value( 3 )[1] );
272 geode::OpenGeodeBasicException::test( attribute->value( 3 )[2] == 3.,
273 "Value [3,2] Should be equal to 3., not ", attribute->value( 3 )[2] );
274 geode::OpenGeodeBasicException::test( attribute->value( 4 )[0] == 5.6,
275 "Value [4,0] Should be equal to 5.6, not ", attribute->value( 4 )[0] );
276 geode::OpenGeodeBasicException::test( attribute->value( 4 )[1] == 7.,
277 "Value [4,1] Should be equal to 7., not ", attribute->value( 4 )[1] );
278 geode::OpenGeodeBasicException::test( attribute->value( 4 )[2] == 8.1,
279 "Value [4,2] Should be equal to 8.1, not ", attribute->value( 4 )[2] );
280 geode::OpenGeodeBasicException::test( attribute->value( 6 )[0] == 10.,
281 "Value [6,0] Should be equal to 10., not ", attribute->value( 6 )[0] );
282 geode::OpenGeodeBasicException::test( attribute->value( 6 )[1] == 11.,
283 "Value [6,1] Should be equal to 11., not ", attribute->value( 6 )[1] );
284 geode::OpenGeodeBasicException::test( attribute->value( 6 )[2] == 12.,
285 "Value [6,2] Should be equal to 12., not ", attribute->value( 6 )[2] );
286 geode::OpenGeodeBasicException::test( attribute->value( 7 )[0] == 2.,
287 "Value [7,0] Should be equal to 2., not ", attribute->value( 7 )[0] );
288 geode::OpenGeodeBasicException::test( attribute->value( 7 )[1] == 5.,
289 "Value [7,1] Should be equal to 5., not ", attribute->value( 7 )[1] );
290 geode::OpenGeodeBasicException::test( attribute->value( 7 )[2] == 7.,
291 "Value [7,2] Should be equal to 7., not ", attribute->value( 7 )[2] );
292
293 array_attribute->set_value( 3, { 2., 5., 5. } );
294 geode::OpenGeodeBasicException::test(
295 attribute->value( 3 )[0] == 2., "Should be equal to 2." );
296 geode::OpenGeodeBasicException::test(
297 attribute->value( 3 )[1] == 5., "Should be equal to 5." );
298 geode::OpenGeodeBasicException::test(
299 attribute->value( 3 )[2] == 5., "Should be equal to 5." );
300}

Callers 1

testFunction · 0.85

Calls 6

default_valueMethod · 0.80
testFunction · 0.70
set_valueMethod · 0.45
valueMethod · 0.45

Tested by

no test coverage detected