Blender  V3.3
util_task_test.cpp
Go to the documentation of this file.
1 /* SPDX-License-Identifier: Apache-2.0
2  * Copyright 2011-2022 Blender Foundation */
3 
4 #include "testing/testing.h"
5 
6 #include "util/task.h"
7 
9 
10 namespace {
11 
12 void task_run()
13 {
14 }
15 
16 } // namespace
17 
18 TEST(util_task, basic)
19 {
21  TaskPool pool;
22  for (int i = 0; i < 100; ++i) {
24  }
25  TaskPool::Summary summary;
26  pool.wait_work(&summary);
28  EXPECT_EQ(summary.num_tasks_handled, 100);
29 }
30 
31 TEST(util_task, multiple_times)
32 {
33  for (int N = 0; N < 1000; ++N) {
35  TaskPool pool;
36  for (int i = 0; i < 100; ++i) {
38  }
39  TaskPool::Summary summary;
40  pool.wait_work(&summary);
42  EXPECT_EQ(summary.num_tasks_handled, 100);
43  }
44 }
45 
EXPECT_EQ(BLI_expr_pylike_eval(expr, nullptr, 0, &result), EXPR_PYLIKE_INVALID)
static void exit()
Definition: task.cpp:83
static void init(int num_threads=0)
Definition: task.cpp:62
#define CCL_NAMESPACE_END
Definition: cuda/compat.h:9
#define function_bind
#define N
int num_tasks_handled
Definition: task.h:35
void push(TaskRunFunction &&task)
Definition: task.cpp:23
void wait_work(Summary *stats=NULL)
Definition: task.cpp:29
TEST(util_task, basic)