storage: minor changes/tests

This commit is contained in:
Michele Caini
2023-02-22 11:32:15 +01:00
parent e7b30fd36d
commit 631c55ba92
2 changed files with 5 additions and 1 deletions

View File

@@ -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 = {}) {

View File

@@ -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) {