Преглед изворни кода

storage: minor changes/tests

Michele Caini пре 3 година
родитељ
комит
631c55ba92
2 измењених фајлова са 5 додато и 1 уклоњено
  1. 1 1
      src/entt/entity/storage.hpp
  2. 4 0
      test/entt/entity/storage.cpp

+ 1 - 1
src/entt/entity/storage.hpp

@@ -711,7 +711,7 @@ public:
      * @param first An iterator to the first element of the range of entities.
      * @param last An iterator past the last element of the range of entities.
      * @param value An instance of the object to construct.
-     * @return Iterator pointing to the first element inserted, if any.
+     * @return Iterator pointing to the last element inserted, if any.
      */
     template<typename It>
     iterator insert(It first, It last, const value_type &value = {}) {

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

@@ -328,6 +328,8 @@ TEST_F(Storage, Insert) {
     ASSERT_EQ(pool.size(), 2u);
     ASSERT_EQ(pool.get(entities[0u]).value, 99);
     ASSERT_EQ(pool.get(entities[1u]).value, 99);
+    ASSERT_EQ(it++->value, 99);
+    ASSERT_EQ(it->value, 99);
 
     pool.erase(std::begin(entities), std::end(entities));
     const stable_type values[2u] = {stable_type{42}, stable_type{3}};
@@ -342,6 +344,8 @@ TEST_F(Storage, Insert) {
     ASSERT_EQ(pool.index(entities[1u]), 2u);
     ASSERT_EQ(pool.get(entities[0u]).value, 3);
     ASSERT_EQ(pool.get(entities[1u]).value, 42);
+    ASSERT_EQ(it++->value, 3);
+    ASSERT_EQ(it->value, 42);
 }
 
 TEST_F(Storage, InsertEmptyType) {