Go to the source code of this file.
|
| TEST (Reduce, basic) |
|
| TEST (Reduce, chain) |
|
| TEST (Reduce, unorderedReduce) |
|
| TEST (Reduce, unorderedReduceException) |
|
| TEST (Reduce, unorderedReduceFuture) |
|
Definition at line 22 of file ReduceTest.cpp.
References a, b, count, EXPECT_EQ, i, folly::makeFuture(), folly::gen::move, and folly::reduce().
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);
#define EXPECT_EQ(val1, val2)
constexpr detail::Map< Move > move
PUSHMI_INLINE_VAR constexpr struct folly::pushmi::reduce_fn reduce
Future< typename std::decay< T >::type > makeFuture(T &&t)
Definition at line 88 of file ReduceTest.cpp.
References a, b, folly::collect(), folly::collectAll(), count, EXPECT_EQ, f, i, folly::makeFuture(), and folly::gen::move.
89 auto makeFutures = [](
int count) {
90 std::vector<Future<int>> fs;
105 collect(makeFutures(3)).reduce(0, [](
int a,
int&&
b) {
return a +
b; });
std::vector< typename std::enable_if< !std::is_same< invoke_result_t< typename std::iterator_traits< InputIterator >::value_type >, void >::value, invoke_result_t< typename std::iterator_traits< InputIterator >::value_type > >::type > collectAll(InputIterator first, InputIterator last)
#define EXPECT_EQ(val1, val2)
constexpr detail::Map< Move > move
Future< typename std::decay< T >::type > makeFuture(T &&t)
TEST |
( |
Reduce |
, |
|
|
unorderedReduce |
|
|
) |
| |
Definition at line 110 of file ReduceTest.cpp.
References b, EXPECT_EQ, f, folly::Promise< T >::getFuture(), folly::makeFuture(), folly::gen::move, folly::Promise< T >::setValue(), and folly::unorderedReduce().
112 std::vector<Future<int>> fs;
128 std::vector<Future<int>> fs;
#define EXPECT_EQ(val1, val2)
constexpr detail::Map< Move > move
Future< T > unorderedReduce(It first, It last, T initial, F func)
std::enable_if< std::is_same< Unit, B >::value, void >::type setValue()
Future< typename std::decay< T >::type > makeFuture(T &&t)
TEST |
( |
Reduce |
, |
|
|
unorderedReduceException |
|
|
) |
| |
Definition at line 144 of file ReduceTest.cpp.
References b, EXPECT_THROW, f, folly::Promise< T >::getFuture(), folly::gen::move, folly::Promise< T >::setException(), folly::Promise< T >::setValue(), and folly::unorderedReduce().
149 std::vector<Future<int>> fs;
#define EXPECT_THROW(statement, expected_exception)
constexpr detail::Map< Move > move
void setException(exception_wrapper ew)
Future< T > unorderedReduce(It first, It last, T initial, F func)
std::enable_if< std::is_same< Unit, B >::value, void >::type setValue()
TEST |
( |
Reduce |
, |
|
|
unorderedReduceFuture |
|
|
) |
| |
Definition at line 164 of file ReduceTest.cpp.
References b, EXPECT_EQ, f, folly::Promise< T >::getFuture(), folly::gen::move, folly::Promise< T >::setValue(), and folly::unorderedReduce().
169 std::vector<Future<int>> fs;
174 std::vector<Promise<double>> ps(3);
178 return ps[
b - 1].getFuture();
#define EXPECT_EQ(val1, val2)
constexpr detail::Map< Move > move
Future< T > unorderedReduce(It first, It last, T initial, F func)
std::enable_if< std::is_same< Unit, B >::value, void >::type setValue()