28 using namespace folly;
33 auto collect = eachTo<std::string>() | as<vector>();
36 "This is the second line\n" 39 "a few empty lines above\n" 40 "incomplete last line",
42 "complete last line\n",
49 for (
auto&
lines : cases) {
60 TEST(FileGen, ByLineFull) {
61 auto cases = std::vector<std::string>{
64 This is the second line 67 a few empty lines above 68 incomplete last line)"), 70 "complete last line\n",
77 for (
auto&
lines : cases) {
82 byLineFull(file.
path().string().c_str()) | unsplit<std::string>(
"");
91 size_t bufferSize = GetParam();
96 "This is the second line\n" 99 "a few empty lines above\n");
102 auto collect = eachTo<std::string>() | as<vector>();
105 src | eachAs<StringPiece>() |
toFile(
File(file.
fd()), bufferSize);
106 auto found =
byLine(file.
path().string().c_str()) | collect;
113 auto toLine = [](
int v) {
return to<std::string>(
v,
'\n'); };
115 auto squares =
seq(1, 100) |
map([](
int x) {
return x *
x; });
116 squares |
map(toLine) | eachAs<StringPiece>() |
toFile(
File(file.
fd()));
123 DifferentBufferSizes,
125 ::testing::Values(0, 1, 2, 4, 8, 64, 4096));
S resplit(char delimiter, bool keepDelimiter=false)
void write(const T &in, folly::io::Appender &appender)
From from(Container &source)
#define EXPECT_EQ(val1, val2)
Gen seq(Value first, Value last)
—— Concurrent Priority Queue Implementation ——
auto byLineFull(File file, char delim= '\n')
std::string stripLeftMargin(std::string s)
constexpr detail::Sum sum
INSTANTIATE_TEST_CASE_P(DifferentBufferSizes, FileGenBufferedTest,::testing::Values(0, 1, 2, 4, 8, 64, 4096))
Map map(Predicate pred=Predicate())
const fs::path & path() const
S lines(StringPiece source)
#define EXPECT_TRUE(condition)
Future< std::vector< typename std::iterator_traits< InputIterator >::value_type::value_type > > collect(InputIterator first, InputIterator last)
auto byLine(File file, char delim= '\n')
S toFile(File file, size_t bufferSize=4096)
TEST_P(FileGenBufferedTest, FileWriter)