[PATCH] D48348: [ADT] Add zip_longest iterators.

Michael Kruse via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 3 14:39:54 PST 2018


Meinersbur marked an inline comment as done.
Meinersbur added inline comments.


================
Comment at: unittests/ADT/IteratorTest.cpp:464-479
+  using namespace std;
+  vector<unsigned> pi{3, 1, 4, 1, 5, 9};
+
+  int iters = 0;
+  auto zipped = zip_longest_optional(pi, vector<bool>{1, 1, 0, 1});
+  for (auto tup : make_filter_range(zipped, [](decltype(zipped)::value_type t) {
+         return !get<1>(t).hasValue() || get<1>(t).getValue();
----------------
dblaikie wrote:
> This testing is a bit convoluted - the bit testing, etc. Could it be done in a more direct manner, perhaps? (either stamping out/loop unrolling each value & testing the values directly against known constants (rather than against each other) or with a separate container containing the expected resulting pairs - and comparing those in a loop?)
> 
> (similarly below)
This was the same patter as ZipIteratorTest above. Changed to use an explicit `expected` array.


Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D48348/new/

https://reviews.llvm.org/D48348





More information about the llvm-commits mailing list