Browse Source

test: minor changes

Michele Caini 4 years ago
parent
commit
7f59fc6321
3 changed files with 6 additions and 9 deletions
  1. 1 2
      test/entt/core/ident.cpp
  2. 1 2
      test/entt/entity/sparse_set.cpp
  3. 4 5
      test/entt/entity/storage.cpp

+ 1 - 2
test/entt/core/ident.cpp

@@ -27,6 +27,5 @@ TEST(Identifier, Uniqueness) {
 
 TEST(Identifier, SingleType) {
     using id = entt::identifier<a_type>;
-    std::integral_constant<id::identifier_type, id::type<a_type>> ic;
-    (void)ic;
+    [[maybe_unused]] std::integral_constant<id::identifier_type, id::type<a_type>> ic;
 }

+ 1 - 2
test/entt/entity/sparse_set.cpp

@@ -919,8 +919,7 @@ TEST(SparseSet, CanModifyDuringIteration) {
     ASSERT_EQ(set.capacity(), 2u);
 
     // this should crash with asan enabled if we break the constraint
-    const auto entity = *it;
-    (void)entity;
+    [[maybe_unused]] const auto entity = *it;
 }
 
 TEST(SparseSet, ThrowingAllocator) {

+ 4 - 5
test/entt/entity/storage.cpp

@@ -1002,7 +1002,7 @@ TEST(Storage, RespectUnordered) {
 
 TEST(Storage, CanModifyDuringIteration) {
     entt::storage<int> pool;
-    pool.emplace(entt::entity{0}, 42);
+    auto *ptr = &pool.emplace(entt::entity{0}, 42);
 
     ASSERT_EQ(pool.capacity(), ENTT_PACKED_PAGE);
 
@@ -1010,10 +1010,10 @@ TEST(Storage, CanModifyDuringIteration) {
     pool.reserve(ENTT_PACKED_PAGE + 1u);
 
     ASSERT_EQ(pool.capacity(), 2 * ENTT_PACKED_PAGE);
+    ASSERT_EQ(&pool.get(entt::entity{0}), ptr);
 
     // this should crash with asan enabled if we break the constraint
-    const auto entity = *it;
-    (void)entity;
+    [[maybe_unused]] const int &value = *it;
 }
 
 TEST(Storage, ReferencesGuaranteed) {
@@ -1046,8 +1046,7 @@ TEST(Storage, ReferencesGuaranteed) {
 
 TEST(Storage, MoveOnlyComponent) {
     // the purpose is to ensure that move only components are always accepted
-    entt::storage<std::unique_ptr<int>> pool;
-    (void)pool;
+    [[maybe_unused]] entt::storage<std::unique_ptr<int>> pool;
 }
 
 TEST(Storage, UpdateFromDestructor) {