TEST(Parallel_Test, Process_Object_Test_Large) { reset_counters(); TestCls* values = new TestCls[DEFAULT_PARALLEL_THREAD_COUNT + 1]; for (unsigned x = 0; x < DEFAULT_PARALLEL_THREAD_COUNT + 1; ++x) values[x] = x; Future future; parallel.process(values, &TestCls::operator*=, DEFAULT_PARALLEL_THREAD_COUNT + 1, 0, &future, 2); future.wait(); for (unsigned x = 0; x < DEFAULT_PARALLEL_THREAD_COUNT + 1; ++x) ASSERT_EQ(x * 2, values[x].value()); delete[] values; }
TEST(Parallel_Test, Future_Test) { reset_counters(); TestCls* values = new TestCls[DEFAULT_PARALLEL_THREAD_COUNT]; for (unsigned x = 0; x < DEFAULT_PARALLEL_THREAD_COUNT; ++x) values[x] = x; Future future; parallel.process(values, &TestCls::operator*=, DEFAULT_PARALLEL_THREAD_COUNT, 0, &future, 2); ASSERT_EQ(DEFAULT_PARALLEL_THREAD_COUNT, future.worker_count); future.wait(); ASSERT_EQ(future.finished_count, future.worker_count); delete[] values; }
TEST(Parallel_Test, Process_Object_Test_Equal) { reset_counters(); TestCls* values = new TestCls[DEFAULT_PARALLEL_THREAD_COUNT]; for (unsigned x = 0; x < DEFAULT_PARALLEL_THREAD_COUNT; ++x) values[x] = x; Future future; parallel.process(values, &TestCls::operator*=, DEFAULT_PARALLEL_THREAD_COUNT, 0, &future, 2); future.wait(); ASSERT_EQ(DEFAULT_PARALLEL_THREAD_COUNT, multiplication_assignment); for (unsigned x = 0; x < DEFAULT_PARALLEL_THREAD_COUNT; ++x) ASSERT_EQ(x * 2, values[x].value()); delete[] values; }