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

Function test_double_sparse_attribute

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

Source from the content-addressed store, hash-verified

212}
213
214void test_double_sparse_attribute( geode::AttributeManager& manager )
215{
216 auto sparse_attribute =
217 manager.find_or_create_attribute< geode::SparseAttribute, double >(
218 "double", 12., { true, true } );
219 geode::OpenGeodeBasicException::test(
220 sparse_attribute->default_value() == 12, "Wrong default value" );
221 sparse_attribute->set_value( 3, 3 );
222 sparse_attribute->set_value( 7, 7 );
223 manager.assign_attribute_value( 3, 2 );
224 manager.interpolate_attribute_value( { { 1, 7 }, { 0.5, 0.3 } }, 4 );
225
226 auto attribute = manager.find_attribute< double >( "double" );
227 geode::OpenGeodeBasicException::test( attribute->value( 2 ) == 3,
228 "Double sparse value 2 should be equal to 3" );
229 geode::OpenGeodeBasicException::test( attribute->value( 3 ) == 3,
230 "Double sparse value 3 should be equal to 3" );
231 geode::OpenGeodeBasicException::test(
232 attribute->value( 4 ) == 8.1, "Should be equal to 8.1" );
233 geode::OpenGeodeBasicException::test(
234 attribute->value( 6 ) == 12, "Should be equal to 12" );
235 geode::OpenGeodeBasicException::test(
236 attribute->value( 7 ) == 7, "Should be equal to 7" );
237
238 sparse_attribute->set_value( 3, 5 );
239 geode::OpenGeodeBasicException::test(
240 attribute->value( 3 ) == 5, "Should be equal to 5" );
241}
242
243void test_double_array_attribute( geode::AttributeManager& manager )
244{

Callers 1

testFunction · 0.70

Calls 6

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

Tested by

no test coverage detected