[libcxx-commits] [PATCH] D131395: [libc++] Implement `lexicographical_compare_three_way`

Adrian Vogelsgesang via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Mon Aug 8 09:59:22 PDT 2022


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


================
Comment at: libcxx/test/std/algorithms/alg.sorting/alg.three.way/lexicographical_compare_three_way_comp.pass.cpp:40
+  // Identical arrays
+  assert(testLexicographicalCompare(array{90, 81}, array{10, 11}, std::strong_ordering::equal));
+  // "Greater" on 2nd element
----------------
ldionne wrote:
> We should also be testing with iterator archetypes like you've done for the non-`comp` test. Is there a reason why it doesn't apply here?
No real reason. I considered this duplicated test coverage given that `lexicographical_compare_three_way` with a comparator just delegates to `lexicographical_compare_three_way` without a comparator.

Added the test coverage now, though


================
Comment at: libcxx/test/std/algorithms/alg.sorting/alg.three.way/lexicographical_compare_three_way_comp.pass.cpp:42
+  // "Greater" on 2nd element
+  assert(testLexicographicalCompare(array{70, 81}, array{10, 12}, std::strong_ordering::less));
+  // "Less" on 2nd element
----------------
ldionne wrote:
> We should also be testing with more than just `strong_ordering`. The same applies to the non-`comp` test IIUC.
We are now also testing `weak_ordering` and `partial_ordering`


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D131395



More information about the libcxx-commits mailing list