20 using namespace folly;
23 auto makeFutures = [](
int count) {
24 std::vector<Future<int>> fs;
33 auto fs = makeFutures(0);
42 auto fs = makeFutures(1);
51 auto fs = makeFutures(3);
60 auto fs = makeFutures(3);
63 reduce(fs, 0.0, [](
double a,
int&&
b) {
return a +
b + 0.1; });
69 auto fs = makeFutures(3);
72 return makeFuture<double>(a + *
b + 0.1);
79 auto fs = makeFutures(3);
82 return makeFuture<double>(a +
b + 0.1);
89 auto makeFutures = [](
int count) {
90 std::vector<Future<int>> fs;
105 collect(makeFutures(3)).reduce(0, [](
int a,
int&&
b) {
return a +
b; });
112 std::vector<Future<int>> fs;
128 std::vector<Future<int>> fs;
144 TEST(Reduce, unorderedReduceException) {
149 std::vector<Future<int>> fs;
164 TEST(Reduce, unorderedReduceFuture) {
169 std::vector<Future<int>> fs;
174 std::vector<Promise<double>> ps(3);
178 return ps[
b - 1].getFuture();
#define EXPECT_THROW(statement, expected_exception)
#define EXPECT_EQ(val1, val2)
constexpr detail::Map< Move > move
void setException(exception_wrapper ew)
Future< T > unorderedReduce(It first, It last, T initial, F func)
—— Concurrent Priority Queue Implementation ——
Future< T > reduce(It first, It last, T &&initial, F &&func)
Future< std::tuple< Try< typename remove_cvref_t< Fs >::value_type >... > > collectAll(Fs &&...fs)
std::enable_if< std::is_same< Unit, B >::value, void >::type setValue()
Future< std::vector< typename std::iterator_traits< InputIterator >::value_type::value_type > > collect(InputIterator first, InputIterator last)
TEST(SequencedExecutor, CPUThreadPoolExecutor)
Future< typename std::decay< T >::type > makeFuture(T &&t)