[libcxx-commits] [PATCH] D100029: [libcxx][test] Properly construct containers in debug mode tests for map/set

Marek Kurdej via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Thu Apr 8 06:21:44 PDT 2021


curdeius requested changes to this revision.
curdeius added a comment.
This revision now requires changes to proceed.

Very good catch indeed. Thanks.



================
Comment at: libcxx/test/libcxx/containers/unord/unord.map/db_local_iterators_7.pass.cpp:30
+    C::local_iterator i = c.begin(c.bucket(1));
     ++i;
     ++i;
----------------
In order not to repeat this error, could you add `assert(i != c.end(c.bucket(1)));` before and `assert(i == c.end(c.bucket(1)));` after the first increment, please?
And add `assert(i != c.end());` for non-local iterators.
Please factor out `c.bucket(1)` too.

And a nit, `1` can be considered as a (bucket) index if read hastily. Please use some magic value, 42 or whatever, but not 0 nor 1.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D100029



More information about the libcxx-commits mailing list