test: review emitter tests
This commit is contained in:
@@ -2,13 +2,10 @@
|
||||
#include <memory>
|
||||
#include <utility>
|
||||
#include <gtest/gtest.h>
|
||||
#include <common/emitter.h>
|
||||
#include <common/linter.hpp>
|
||||
#include <entt/signal/emitter.hpp>
|
||||
|
||||
struct test_emitter: entt::emitter<test_emitter> {
|
||||
using entt::emitter<test_emitter>::emitter;
|
||||
};
|
||||
|
||||
struct foo_event {
|
||||
int i;
|
||||
};
|
||||
@@ -17,13 +14,13 @@ struct bar_event {};
|
||||
struct quux_event {};
|
||||
|
||||
TEST(Emitter, Move) {
|
||||
test_emitter emitter{};
|
||||
test::emitter emitter{};
|
||||
emitter.on<foo_event>([](auto &, const auto &) {});
|
||||
|
||||
ASSERT_FALSE(emitter.empty());
|
||||
ASSERT_TRUE(emitter.contains<foo_event>());
|
||||
|
||||
test_emitter other{std::move(emitter)};
|
||||
test::emitter other{std::move(emitter)};
|
||||
|
||||
test::is_initialized(emitter);
|
||||
|
||||
@@ -40,8 +37,8 @@ TEST(Emitter, Move) {
|
||||
}
|
||||
|
||||
TEST(Emitter, Swap) {
|
||||
test_emitter emitter{};
|
||||
test_emitter other{};
|
||||
test::emitter emitter{};
|
||||
test::emitter other{};
|
||||
int value{};
|
||||
|
||||
emitter.on<foo_event>([&value](auto &event, const auto &) {
|
||||
@@ -64,7 +61,7 @@ TEST(Emitter, Swap) {
|
||||
}
|
||||
|
||||
TEST(Emitter, Clear) {
|
||||
test_emitter emitter{};
|
||||
test::emitter emitter{};
|
||||
|
||||
ASSERT_TRUE(emitter.empty());
|
||||
|
||||
@@ -106,7 +103,7 @@ TEST(Emitter, Clear) {
|
||||
}
|
||||
|
||||
TEST(Emitter, ClearFromCallback) {
|
||||
test_emitter emitter{};
|
||||
test::emitter emitter{};
|
||||
|
||||
ASSERT_TRUE(emitter.empty());
|
||||
|
||||
@@ -129,7 +126,7 @@ TEST(Emitter, ClearFromCallback) {
|
||||
}
|
||||
|
||||
TEST(Emitter, On) {
|
||||
test_emitter emitter{};
|
||||
test::emitter emitter{};
|
||||
int value{};
|
||||
|
||||
emitter.on<foo_event>([&value](auto &event, const auto &) {
|
||||
@@ -146,8 +143,8 @@ TEST(Emitter, On) {
|
||||
}
|
||||
|
||||
TEST(Emitter, OnAndErase) {
|
||||
test_emitter emitter{};
|
||||
const std::function<void(bar_event &, test_emitter &)> func{};
|
||||
test::emitter emitter{};
|
||||
const std::function<void(bar_event &, test::emitter &)> func{};
|
||||
|
||||
emitter.on(func);
|
||||
|
||||
@@ -162,7 +159,7 @@ TEST(Emitter, OnAndErase) {
|
||||
|
||||
TEST(Emitter, CustomAllocator) {
|
||||
const std::allocator<void> allocator{};
|
||||
test_emitter emitter{allocator};
|
||||
test::emitter emitter{allocator};
|
||||
|
||||
ASSERT_EQ(emitter.get_allocator(), allocator);
|
||||
ASSERT_FALSE(emitter.get_allocator() != allocator);
|
||||
|
||||
Reference in New Issue
Block a user