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

Function test_foo_variable_attribute

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

Source from the content-addressed store, hash-verified

142}
143
144void test_foo_variable_attribute( geode::AttributeManager& manager )
145{
146 auto variable_attribute =
147 manager.find_or_create_attribute< geode::VariableAttribute, Foo >(
148 "foo_var", Foo{}, { false, false, false } );
149 manager.set_attribute_properties( "foo_var", { true, false, true } );
150 geode::OpenGeodeBasicException::test(
151 variable_attribute->properties().assignable
152 && !variable_attribute->properties().interpolable
153 && variable_attribute->properties().transferable,
154 "Attribute should be assignable, not interpolable and "
155 "transferable." );
156 variable_attribute->set_properties( { true, true } );
157 geode::OpenGeodeBasicException::test(
158 variable_attribute->properties().interpolable,
159 "Attribute should be interpolable." );
160 geode::OpenGeodeBasicException::test(
161 variable_attribute->properties().transferable,
162 "Attribute should be transferable." );
163 variable_attribute->modify_value( 3, []( Foo& foo ) {
164 foo.double_ = 12.4;
165 } );
166 geode::OpenGeodeBasicException::test(
167 variable_attribute->value( 0 ).double_ == 0, "Should be equal to 0" );
168 geode::OpenGeodeBasicException::test(
169 variable_attribute->value( 3 ).double_ == 12.4,
170 "Should be equal to 12.4" );
171}
172
173void test_int_variable_attribute( geode::AttributeManager& manager )
174{

Callers 1

testFunction · 0.85

Calls 5

set_propertiesMethod · 0.80
testFunction · 0.70
modify_valueMethod · 0.45
valueMethod · 0.45

Tested by

no test coverage detected