*
* 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>> {
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,