test: scheduler - close #1257

This commit is contained in:
skypjack
2025-07-28 15:10:11 +02:00
parent 3bcbea785a
commit 17e88e506c
2 changed files with 14 additions and 1 deletions

1
TODO
View File

@@ -38,4 +38,3 @@ TODO:
* avoid copying meta_type/data/func nodes
* paged vector as a standalone class
* operator bool to meta custom
* test process and scheduler with allocators

View File

@@ -107,6 +107,20 @@ TEST(Scheduler, Swap) {
ASSERT_EQ(counter, 2);
}
TEST(Scheduler, SharedFromThis) {
entt::scheduler scheduler{};
auto &process = scheduler.attach<succeeded_process>();
const auto &then = process.then<failed_process>();
auto other = process.shared_from_this();
ASSERT_TRUE(other);
ASSERT_NE(&process, &then);
ASSERT_EQ(&process, other.get());
ASSERT_EQ(process.get_allocator(), scheduler.get_allocator());
ASSERT_EQ(process.get_allocator(), other->get_allocator());
ASSERT_EQ(then.get_allocator(), scheduler.get_allocator());
}
TEST(Scheduler, AttachThen) {
entt::scheduler scheduler{};
std::pair<int, int> counter{};