@@ -21,7 +21,7 @@ struct custom_entity_traits {
21
21
using entity_type = std::uint32_t ;
22
22
using version_type = std::uint16_t ;
23
23
static constexpr entity_type entity_mask = 0x3FFFF ; // 18b
24
- static constexpr entity_type version_mask = 0x3FFF ; // 14b
24
+ static constexpr entity_type version_mask = 0x0FFF ; // 12b
25
25
};
26
26
27
27
template <>
@@ -765,6 +765,36 @@ TYPED_TEST(SparseSet, Contains) {
765
765
766
766
ASSERT_FALSE (set.contains (entity));
767
767
ASSERT_FALSE (set.contains (other));
768
+
769
+ if constexpr (traits_type::to_integral (entt::tombstone) != ~traits_type::entity_type{}) {
770
+ // test reserved bits, if any
771
+ constexpr entity_type reserved{traits_type::to_integral (entity) | (traits_type::to_integral (entt::tombstone) + 1u )};
772
+
773
+ ASSERT_NE (entity, reserved);
774
+
775
+ set.push (reserved);
776
+
777
+ ASSERT_TRUE (set.contains (entity));
778
+ ASSERT_TRUE (set.contains (reserved));
779
+
780
+ ASSERT_NE (*set.find (entity), entity);
781
+ ASSERT_EQ (*set.find (entity), reserved);
782
+
783
+ set.bump (entity);
784
+
785
+ ASSERT_TRUE (set.contains (entity));
786
+ ASSERT_TRUE (set.contains (reserved));
787
+
788
+ ASSERT_NE (*set.find (reserved), reserved);
789
+ ASSERT_EQ (*set.find (reserved), entity);
790
+
791
+ set.erase (reserved);
792
+
793
+ ASSERT_FALSE (set.contains (entity));
794
+ ASSERT_FALSE (set.contains (reserved));
795
+
796
+ ASSERT_EQ (set.find (reserved), set.end ());
797
+ }
768
798
}
769
799
}
770
800
0 commit comments