diff --git a/source/core/test/CMakeLists.txt b/source/core/test/CMakeLists.txt index 565a4aec95..0bec567481 100644 --- a/source/core/test/CMakeLists.txt +++ b/source/core/test/CMakeLists.txt @@ -31,6 +31,7 @@ target_sources(tactile-core-test "src/map/map_test.cpp" "src/meta/attribute_type_test.cpp" "src/meta/color_test.cpp" + "src/meta/meta_test.cpp" "src/model/settings_test.cpp" "src/numeric/random_test.cpp" "src/platform/bits_test.cpp" diff --git a/source/core/test/src/meta/meta_test.cpp b/source/core/test/src/meta/meta_test.cpp new file mode 100644 index 0000000000..791fe57629 --- /dev/null +++ b/source/core/test/src/meta/meta_test.cpp @@ -0,0 +1,41 @@ +// Copyright (C) 2024 Albin Johansson (GNU General Public License v3.0) + +#include "tactile/core/meta/meta.hpp" + +#include +#include + +#include "tactile/base/test_util/ir_presets.hpp" +#include "tactile/core/entity/registry.hpp" +#include "tactile/core/test/ir_comparison.hpp" + +namespace tactile::test { + +// tactile::is_meta +TEST(Meta, IsMeta) +{ + Registry registry {}; + + const auto meta_id = registry.make_entity(); + registry.add(meta_id); + + EXPECT_FALSE(is_meta(registry, kInvalidEntity)); + EXPECT_FALSE(is_meta(registry, registry.make_entity())); + EXPECT_TRUE(is_meta(registry, meta_id)); +} + +// tactile::convert_ir_metadata +TEST(Meta, ConvertIrMetadata) +{ + Registry registry {}; + + const auto meta_id = registry.make_entity(); + registry.add(meta_id); + + const auto ir_metadata = make_complex_ir_metadata("Meta"); + convert_ir_metadata(registry, meta_id, ir_metadata); + + compare_meta(registry, meta_id, ir_metadata); +} + +} // namespace tactile::test