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

Function test_constant_attribute

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

Source from the content-addressed store, hash-verified

107} // namespace geode
108
109void test_constant_attribute( geode::AttributeManager& manager )
110{
111 auto constant_attribute =
112 manager.find_or_create_attribute< geode::ConstantAttribute, bool >(
113 "bool", true, { true, true } );
114 geode::OpenGeodeBasicException::test(
115 constant_attribute->name() == "bool", "Wrong attribute name" );
116 geode::OpenGeodeBasicException::test(
117 constant_attribute->default_value() == true, "Wrong default value" );
118
119 auto attribute = manager.find_attribute< bool >( "bool" );
120 geode::OpenGeodeBasicException::test(
121 attribute->value( 0 ), "Should be equal to true" );
122 geode::OpenGeodeBasicException::test(
123 attribute->type() == typeid( bool ).name(),
124 "Should be equal to 'b' or 'bool'" );
125
126 constant_attribute->set_value( false );
127 geode::OpenGeodeBasicException::test(
128 !attribute->value( 12 ), "Should be equal to false" );
129}
130
131void test_foo_constant_attribute( geode::AttributeManager& manager )
132{

Callers 1

testFunction · 0.70

Calls 6

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

Tested by

no test coverage detected