32 .thenValue([&](
auto&&) {
return 42; })
33 .thenValue([&](
int n) {
return folly::to<std::string>(n); })
39 TEST_F(ThreadedExecutorTest, dtor_waits) {
40 constexpr
auto kDelay = std::chrono::milliseconds(100);
41 auto x = std::make_unique<folly::ThreadedExecutor>();
43 std::this_thread::sleep_for(kDelay);
51 constexpr
auto kNumTasks = 1024;
55 folly::gen::range<size_t>(0, kNumTasks) |
58 .thenValue([=](
auto&&) {
return i; })
59 .thenValue([](
size_t k) {
return folly::to<std::string>(
k); });
61 folly::gen::as<std::vector>())
67 TEST_F(ThreadedExecutorTest, many_sleeping_constant_time) {
68 constexpr
auto kNumTasks = 256;
69 constexpr
auto kDelay = std::chrono::milliseconds(100);
73 folly::gen::range<size_t>(0, kNumTasks) |
76 .thenValue([=](
auto&&) {
77 std::this_thread::sleep_for(kDelay);
79 .thenValue([=](
auto&&) {
return i; })
80 .thenValue([](
size_t k) {
return folly::to<std::string>(
k); });
82 folly::gen::as<std::vector>())
88 TEST_F(ThreadedExecutorTest, many_sleeping_decreasing_time) {
89 constexpr
auto kNumTasks = 256;
90 constexpr
auto kDelay = std::chrono::milliseconds(100);
94 folly::gen::range<size_t>(0, kNumTasks) |
97 .thenValue([=](
auto&&) {
98 auto delay = kDelay * (kNumTasks -
i) / kNumTasks;
99 std::this_thread::sleep_for(delay);
101 .thenValue([=](
auto&&) {
return i; })
102 .thenValue([](
size_t k) {
return folly::to<std::string>(
k); });
104 folly::gen::as<std::vector>())
TEST_F(TestInfoTest, Names)
#define EXPECT_EQ(val1, val2)
Map map(Predicate pred=Predicate())
#define EXPECT_TRUE(condition)
Future< std::vector< typename std::iterator_traits< InputIterator >::value_type::value_type > > collect(InputIterator first, InputIterator last)
auto via(Executor *x, Func &&func) -> Future< typename isFutureOrSemiFuture< decltype(std::declval< Func >()())>::Inner >