/*
- * Copyright 2014 Facebook, Inc.
+ * Copyright 2014-present Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-#include <gtest/gtest.h>
#include <string>
-#include <vector>
#include <tuple>
+#include <vector>
-#include <folly/Range.h>
#include <folly/FBVector.h>
-#include <folly/experimental/TestUtil.h>
+#include <folly/Range.h>
#include <folly/gen/Base.h>
#include <folly/gen/Combine.h>
+#include <folly/portability/GTest.h>
using namespace folly::gen;
using namespace folly;
using std::vector;
using std::tuple;
+const folly::gen::detail::Map<
+ folly::gen::detail::MergeTuples> gTupleFlatten{};
+
auto even = [](int i) -> bool { return i % 2 == 0; };
auto odd = [](int i) -> bool { return i % 2 == 1; };
EXPECT_EQ(std::get<1>(zipped1[0]), std::make_tuple('A'));
auto zipped2 = from(zipped1)
- | tuple_flatten
+ | gTupleFlatten
| assert_type<tuple<int, string, char>&&>()
| as<vector>();
ASSERT_EQ(zipped2.size(), 3);
auto zipped3 = from(charTupleVec)
| zip(intStringTupleVec)
- | tuple_flatten
+ | gTupleFlatten
| assert_type<tuple<char, int, string>&&>()
| as<vector>();
ASSERT_EQ(zipped3.size(), 3);
auto zipped4 = from(intStringTupleVec)
| zip(doubleVec)
- | tuple_flatten
+ | gTupleFlatten
| assert_type<tuple<int, string, double>&&>()
| as<vector>();
ASSERT_EQ(zipped4.size(), 3);
auto zipped5 = from(doubleVec)
| zip(doubleVec)
| assert_type<tuple<double, double>>()
- | tuple_flatten // essentially a no-op
+ | gTupleFlatten // essentially a no-op
| assert_type<tuple<double, double>&&>()
| as<vector>();
ASSERT_EQ(zipped5.size(), 5);
auto zipped6 = from(intStringTupleVec)
| zip(charTupleVec)
- | tuple_flatten
+ | gTupleFlatten
| zip(doubleVec)
- | tuple_flatten
+ | gTupleFlatten
| assert_type<tuple<int, string, char, double>&&>()
| as<vector>();
ASSERT_EQ(zipped6.size(), 3);
int main(int argc, char *argv[]) {
testing::InitGoogleTest(&argc, argv);
- google::ParseCommandLineFlags(&argc, &argv, true);
+ gflags::ParseCommandLineFlags(&argc, &argv, true);
return RUN_ALL_TESTS();
}