Skip to content

Commit

Permalink
Minor fixes from documentation
Browse files Browse the repository at this point in the history
Test Plan: unittests

Reviewed By: jbrewer@fb.com, ashishsharma@fb.com

Subscribers: maxime, folly-diffs@, yfeldblum, chalfant

FB internal diff: D1956101

Signature: t1:1956101:1427828321:2d828e6f2c06c6dcd6e7baa3ed5e72ee59d9b77f
  • Loading branch information
ddrcoder authored and afrind committed Apr 2, 2015
1 parent 0660730 commit 8cb8090
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion folly/gen/ParallelMap-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ namespace folly { namespace gen { namespace detail {
*
* This type is usually used through the 'pmap' helper function:
*
* auto squares = seq(1, 10) | pmap(4, fibonacci) | sum;
* auto squares = seq(1, 10) | pmap(fibonacci, 4) | sum;
*/
template<class Predicate>
class PMap : public Operator<PMap<Predicate>> {
Expand Down
10 changes: 10 additions & 0 deletions folly/gen/test/FileTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,16 @@ TEST_P(FileGenBufferedTest, FileWriter) {
EXPECT_TRUE(expected == found);
}

TEST(FileGenBufferedTest, FileWriterSimple) {
test::TemporaryFile file("FileWriter");
auto toLine = [](int v) { return to<std::string>(v, '\n'); };

auto squares = seq(1, 100) | map([](int x) { return x * x; });
squares | map(toLine) | eachAs<StringPiece>() | toFile(File(file.fd()));
EXPECT_EQ(squares | sum,
byLine(File(file.path().c_str())) | eachTo<int>() | sum);
}

INSTANTIATE_TEST_CASE_P(
DifferentBufferSizes,
FileGenBufferedTest,
Expand Down

0 comments on commit 8cb8090

Please sign in to comment.