Commit ea216b9b authored by Yedidya Feldblum's avatar Yedidya Feldblum Committed by Facebook Github Bot

Hide some test helper functions

Summary: [Folly] Hide some test helper functions to permit some tests to be linked together into the same binary, if desired.

Differential Revision: D18746529

fbshipit-source-id: 9829eb1227cb348f65734ceb670c85508577763d
parent c8c0682f
...@@ -25,6 +25,8 @@ ...@@ -25,6 +25,8 @@
using namespace folly::coro; using namespace folly::coro;
namespace {
AsyncGenerator<int> generateInts(int begin, int end) { AsyncGenerator<int> generateInts(int begin, int end) {
for (int i = begin; i < end; i++) { for (int i = begin; i < end; i++) {
co_await co_reschedule_on_current_executor; co_await co_reschedule_on_current_executor;
...@@ -32,6 +34,8 @@ AsyncGenerator<int> generateInts(int begin, int end) { ...@@ -32,6 +34,8 @@ AsyncGenerator<int> generateInts(int begin, int end) {
} }
} }
} // namespace
TEST(AccumulateTest, NoOperationProvided) { TEST(AccumulateTest, NoOperationProvided) {
auto result = blockingWait(accumulate(generateInts(0, 5), 0)); auto result = blockingWait(accumulate(generateInts(0, 5), 0));
auto expected = 0 + 1 + 2 + 3 + 4; auto expected = 0 + 1 + 2 + 3 + 4;
......
...@@ -27,6 +27,8 @@ ...@@ -27,6 +27,8 @@
using namespace ::testing; using namespace ::testing;
using namespace folly::coro; using namespace folly::coro;
namespace {
AsyncGenerator<int> generateInts(int begin, int end) { AsyncGenerator<int> generateInts(int begin, int end) {
for (int i = begin; i < end; i++) { for (int i = begin; i < end; i++) {
co_await co_reschedule_on_current_executor; co_await co_reschedule_on_current_executor;
...@@ -42,6 +44,8 @@ Task<std::vector<int>> toVector(AsyncGenerator<int> generator) { ...@@ -42,6 +44,8 @@ Task<std::vector<int>> toVector(AsyncGenerator<int> generator) {
co_return result; co_return result;
} }
} // namespace
TEST(ConcatTest, ConcatSingle) { TEST(ConcatTest, ConcatSingle) {
auto gen = concat(generateInts(0, 5)); auto gen = concat(generateInts(0, 5));
auto result = blockingWait(toVector(std::move(gen))); auto result = blockingWait(toVector(std::move(gen)));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment