[libcxx-commits] [PATCH] D56500: [libcxx] Fix order checking in unordered_multiset tests.

Louis Dionne via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Mon Jan 28 12:31:03 PST 2019


ldionne requested changes to this revision.
ldionne added inline comments.
This revision now requires changes to proceed.


================
Comment at: test/std/containers/unord/unord.multiset/unord.multiset.cnstr/assign_copy.pass.cpp:67
         C::const_iterator i = c.cbegin();
-        assert(*i == 1);
-        ++i;
-        assert(*i == 1);
-        ++i;
-        assert(*i == 2);
-        ++i;
-        assert(*i == 2);
-        ++i;
-        assert(*i == 3);
-        ++i;
-        assert(*i == 4);
+        C::const_iterator ie = c.end();
+        std::set<int> s;
----------------
Wouldn't it be enough (and simpler) to do something like this:

```
std::map<int, int> counts;
for (C::const_iterator i = c.cbegin(), ie = c.cend(); i != ie; ++i) {
  counts[*i]++;
}
assert(counts[1] == 2);
assert(counts[2] == 2);
assert(counts[3] == 1);
assert(counts[4] == 1);
assert(counts.size() == 4);
```

I find the proposed patch difficult to follow.



Repository:
  rCXX libc++

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

https://reviews.llvm.org/D56500





More information about the libcxx-commits mailing list