|
@@ -108,13 +108,20 @@ TEST(Scheduler, Then) {
|
|
|
entt::scheduler scheduler{};
|
|
entt::scheduler scheduler{};
|
|
|
std::pair<int, int> counter{};
|
|
std::pair<int, int> counter{};
|
|
|
|
|
|
|
|
- scheduler
|
|
|
|
|
- // failing process with successor
|
|
|
|
|
- .attach(std::make_shared<succeeded_process>()->then(std::make_shared<succeeded_process>()->then(std::make_shared<failed_process>()->then(std::make_shared<succeeded_process>()))))
|
|
|
|
|
- // failing process without successor
|
|
|
|
|
- .attach(std::make_shared<succeeded_process>()->then(std::make_shared<succeeded_process>()->then(std::make_shared<failed_process>())))
|
|
|
|
|
- // non-failing process
|
|
|
|
|
- .attach(std::make_shared<succeeded_process>()->then(std::make_shared<succeeded_process>()));
|
|
|
|
|
|
|
+ // failing process with successor
|
|
|
|
|
+ scheduler.attach(std::make_shared<succeeded_process>())
|
|
|
|
|
+ ->then(std::make_shared<succeeded_process>())
|
|
|
|
|
+ ->then(std::make_shared<failed_process>())
|
|
|
|
|
+ ->then(std::make_shared<succeeded_process>());
|
|
|
|
|
+
|
|
|
|
|
+ // failing process without successor
|
|
|
|
|
+ scheduler.attach(std::make_shared<succeeded_process>())
|
|
|
|
|
+ ->then(std::make_shared<succeeded_process>())
|
|
|
|
|
+ ->then(std::make_shared<failed_process>());
|
|
|
|
|
+
|
|
|
|
|
+ // non-failing process
|
|
|
|
|
+ scheduler.attach(std::make_shared<succeeded_process>())
|
|
|
|
|
+ ->then(std::make_shared<succeeded_process>());
|
|
|
|
|
|
|
|
while(!scheduler.empty()) {
|
|
while(!scheduler.empty()) {
|
|
|
scheduler.update(0, &counter);
|
|
scheduler.update(0, &counter);
|
|
@@ -142,7 +149,9 @@ TEST(Scheduler, Functor) {
|
|
|
proc.fail();
|
|
proc.fail();
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
- scheduler.attach(entt::process_from(std::move(attach))->then(entt::process_from(std::move(then))->then(entt::process_from([](entt::process &, std::uint32_t, void *) { FAIL(); }))));
|
|
|
|
|
|
|
+ scheduler.attach(entt::process_from(std::move(attach)))
|
|
|
|
|
+ ->then(entt::process_from(std::move(then)))
|
|
|
|
|
+ ->then(entt::process_from([](entt::process &, std::uint32_t, void *) { FAIL(); }));
|
|
|
|
|
|
|
|
while(!scheduler.empty()) {
|
|
while(!scheduler.empty()) {
|
|
|
scheduler.update(0);
|
|
scheduler.update(0);
|
|
@@ -158,7 +167,7 @@ TEST(Scheduler, SpawningProcess) {
|
|
|
std::pair<int, int> counter{};
|
|
std::pair<int, int> counter{};
|
|
|
|
|
|
|
|
scheduler.attach(entt::process_from([&scheduler](entt::process &proc, std::uint32_t, void *) {
|
|
scheduler.attach(entt::process_from([&scheduler](entt::process &proc, std::uint32_t, void *) {
|
|
|
- scheduler.attach(std::make_shared<succeeded_process>()->then(std::make_shared<failed_process>()));
|
|
|
|
|
|
|
+ scheduler.attach(std::make_shared<succeeded_process>())->then(std::make_shared<failed_process>());
|
|
|
proc.succeed();
|
|
proc.succeed();
|
|
|
}));
|
|
}));
|
|
|
|
|
|