Browse Source

test: more on storage optimization

Michele Caini 2 years ago
parent
commit
504959850c
1 changed files with 16 additions and 0 deletions
  1. 16 0
      test/entt/entity/storage_no_instance.cpp

+ 16 - 0
test/entt/entity/storage_no_instance.cpp

@@ -182,6 +182,22 @@ ENTT_DEBUG_TYPED_TEST(StorageNoInstanceDeathTest, Getters) {
     ASSERT_DEATH([[maybe_unused]] const auto value = std::as_const(pool).get_as_tuple(entt::entity{41}), "");
 }
 
+TYPED_TEST(StorageNoInstance, Value) {
+    using value_type = typename TestFixture::type;
+    entt::storage<value_type> pool;
+
+    pool.emplace(entt::entity{42});
+
+    ASSERT_EQ(pool.value(entt::entity{42}), nullptr);
+}
+
+ENTT_DEBUG_TYPED_TEST(StorageNoInstanceDeathTest, Value) {
+    using value_type = typename TestFixture::type;
+    entt::storage<value_type> pool;
+
+    ASSERT_DEATH([[maybe_unused]] const void *value = pool.value(entt::entity{42}), "");
+}
+
 TYPED_TEST(StorageNoInstance, Emplace) {
     using value_type = typename TestFixture::type;
     entt::storage<value_type> pool;