snapshot: code coverage
This commit is contained in:
@@ -172,9 +172,7 @@ public:
|
||||
basic_snapshot_loader(registry_type &source) noexcept
|
||||
: reg{&source} {
|
||||
// restoring a snapshot as a whole requires a clean registry
|
||||
for([[maybe_unused]] auto elem: source.storage()) {
|
||||
ENTT_ASSERT(elem.second.empty(), "Registry must be empty");
|
||||
}
|
||||
ENTT_ASSERT(reg->template storage<entity_type>().empty() && (reg->storage().begin() == reg->storage().end()), "Registry must be empty");
|
||||
}
|
||||
|
||||
/*! @brief Default move constructor. */
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#include <entt/entity/registry.hpp>
|
||||
#include <entt/entity/snapshot.hpp>
|
||||
#include <entt/signal/sigh.hpp>
|
||||
#include "../common/config.h"
|
||||
|
||||
struct empty {};
|
||||
|
||||
@@ -231,6 +232,13 @@ TEST(BasicSnapshotLoader, Constructors) {
|
||||
ASSERT_NO_FATAL_FAILURE(loader = std::move(other));
|
||||
}
|
||||
|
||||
ENTT_DEBUG_TEST(BasicSnapshotLoaderDeathTest, Constructors) {
|
||||
entt::registry registry;
|
||||
registry.emplace<int>(registry.create());
|
||||
|
||||
ASSERT_DEATH([[maybe_unused]] entt::basic_snapshot_loader loader{registry}, "");
|
||||
}
|
||||
|
||||
TEST(BasicSnapshotLoader, GetEntityType) {
|
||||
using namespace entt::literals;
|
||||
using traits_type = entt::entt_traits<entt::entity>;
|
||||
|
||||
Reference in New Issue
Block a user