| 107 | } // namespace geode |
| 108 | |
| 109 | void 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 | |
| 131 | void test_foo_constant_attribute( geode::AttributeManager& manager ) |
| 132 | { |