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

Function test_generic_value

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

Source from the content-addressed store, hash-verified

475}
476
477void test_generic_value( geode::AttributeManager& manager )
478{
479 const auto& foo_attr = manager.find_attribute< Foo >( "foo_spr" );
480 geode::OpenGeodeBasicException::test(
481 foo_attr->is_genericable(), "Foo attribute should be genericable" );
482 geode::OpenGeodeBasicException::test( foo_attr->generic_value( 3 ) == 15.4f,
483 "Generic value for element 3 of foo sparse attribute should be "
484 "15.4" );
485
486 const auto& double_attr = manager.find_attribute< double >( "double" );
487 geode::OpenGeodeBasicException::test( double_attr->generic_value( 7 ) == 7,
488 "Generic value for element 7 of double attribute should be 7" );
489
490 auto array_attr =
491 manager.find_or_create_attribute< geode::VariableAttribute,
492 std::array< double, 2 > >(
493 "array_double", std::array< double, 2 >() );
494 array_attr->set_value( 2, { 3.1, 1.3 } );
495 geode::OpenGeodeBasicException::test(
496 array_attr->is_genericable(), "Foo attribute is genericable" );
497 geode::OpenGeodeBasicException::test(
498 array_attr->generic_value( 2 ) == 3.1f,
499 "Generic value for element 2 of array attribute should be 3.1" );
500 geode::OpenGeodeBasicException::test(
501 array_attr->generic_item_value( 2, 0 ) == 3.1f,
502 "Generic value for element 2,0 of array attribute should be "
503 "3.1" );
504 geode::OpenGeodeBasicException::test(
505 array_attr->generic_item_value( 2, 1 ) == 1.3f,
506 "Generic value for element 2,1 of array attribute should be "
507 "1.3" );
508}
509
510void test_copy_manager( geode::AttributeManager& manager )
511{

Callers 1

testFunction · 0.85

Calls 5

generic_item_valueMethod · 0.80
testFunction · 0.70
is_genericableMethod · 0.45
generic_valueMethod · 0.45
set_valueMethod · 0.45

Tested by

no test coverage detected