performance improvements

This commit is contained in:
Michele Caini
2017-08-16 17:58:33 +02:00
parent dd1524b245
commit 169cb66276
4 changed files with 116 additions and 114 deletions

View File

@@ -13,8 +13,8 @@ TEST(ComponentPool, Functionalities) {
ASSERT_EQ(pool.capacity<double>(), pool_type::size_type{0});
ASSERT_EQ(pool.size<int>(), pool_type::size_type{0});
ASSERT_EQ(pool.size<double>(), pool_type::size_type{0});
ASSERT_EQ(pool.entities<int>(), pool.entities<int>() + pool.size<int>());
ASSERT_EQ(pool.entities<double>(), pool.entities<double>() + pool.size<double>());
ASSERT_EQ(pool.begin<int>(), pool.end<int>());
ASSERT_EQ(pool.begin<double>(), pool.end<double>());
ASSERT_FALSE(pool.has<int>(0));
ASSERT_FALSE(pool.has<double>(0));
}
@@ -126,7 +126,7 @@ TEST(ComponentPool, HasGet) {
ASSERT_NO_THROW(pool.destroy<int>(0));
}
TEST(ComponentPool, EntitiesReset) {
TEST(ComponentPool, BeginEndReset) {
using pool_type = entt::ComponentPool<std::uint8_t, int, char>;
pool_type pool{2};
@@ -137,17 +137,17 @@ TEST(ComponentPool, EntitiesReset) {
ASSERT_EQ(pool.construct<int>(1, 1), 1);
ASSERT_EQ(pool.size<int>(), decltype(pool.size<int>()){4});
ASSERT_EQ(pool.entities<int>()[0], typename pool_type::entity_type{0});
ASSERT_EQ(pool.entities<int>()[1], typename pool_type::entity_type{2});
ASSERT_EQ(pool.entities<int>()[2], typename pool_type::entity_type{3});
ASSERT_EQ(pool.entities<int>()[3], typename pool_type::entity_type{1});
ASSERT_EQ(*(pool.begin<int>()+0), typename pool_type::entity_type{0});
ASSERT_EQ(*(pool.begin<int>()+1), typename pool_type::entity_type{2});
ASSERT_EQ(*(pool.begin<int>()+2), typename pool_type::entity_type{3});
ASSERT_EQ(*(pool.begin<int>()+3), typename pool_type::entity_type{1});
pool.destroy<int>(2);
ASSERT_EQ(pool.size<int>(), decltype(pool.size<int>()){3});
ASSERT_EQ(pool.entities<int>()[0], typename pool_type::entity_type{0});
ASSERT_EQ(pool.entities<int>()[1], typename pool_type::entity_type{1});
ASSERT_EQ(pool.entities<int>()[2], typename pool_type::entity_type{3});
ASSERT_EQ(*(pool.begin<int>()+0), typename pool_type::entity_type{0});
ASSERT_EQ(*(pool.begin<int>()+1), typename pool_type::entity_type{1});
ASSERT_EQ(*(pool.begin<int>()+2), typename pool_type::entity_type{3});
ASSERT_EQ(pool.construct<char>(0, 'c'), 'c');