blender_test/intern/cycles/test/util_task_test.cpp
Brecht Van Lommel 9cfc7967dd Cycles: use SPDX license headers
* Replace license text in headers with SPDX identifiers.
* Remove specific license info from outdated readme.txt, instead leave details
  to the source files.
* Add list of SPDX license identifiers used, and corresponding license texts.
* Update copyright dates while we're at it.

Ref D14069, T95597
2022-02-11 17:47:34 +01:00

47 lines
847 B
C++

/* SPDX-License-Identifier: Apache-2.0
* Copyright 2011-2022 Blender Foundation */
#include "testing/testing.h"
#include "util/task.h"
CCL_NAMESPACE_BEGIN
namespace {
void task_run()
{
}
} // namespace
TEST(util_task, basic)
{
TaskScheduler::init(0);
TaskPool pool;
for (int i = 0; i < 100; ++i) {
pool.push(function_bind(task_run));
}
TaskPool::Summary summary;
pool.wait_work(&summary);
TaskScheduler::exit();
EXPECT_EQ(summary.num_tasks_handled, 100);
}
TEST(util_task, multiple_times)
{
for (int N = 0; N < 1000; ++N) {
TaskScheduler::init(0);
TaskPool pool;
for (int i = 0; i < 100; ++i) {
pool.push(function_bind(task_run));
}
TaskPool::Summary summary;
pool.wait_work(&summary);
TaskScheduler::exit();
EXPECT_EQ(summary.num_tasks_handled, 100);
}
}
CCL_NAMESPACE_END