[libcxx-commits] [PATCH] D109668: [libc++][test] Fix iterator assertion in span.cons/deduct.pass.cpp

Joe Loser via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Sun Sep 12 19:13:38 PDT 2021


jloser created this revision.
jloser added reviewers: Quuxplusone, ldionne, Mordante, zoecarver.
jloser requested review of this revision.
Herald added a project: libc++.
Herald added a subscriber: libcxx-commits.
Herald added a reviewer: libc++.

Two tests in `span.cons/deduct.pass.cpp` accidentally check whether the
iterator range from member begin and member end are equivalent to the
ones from free begin and free end. This is obviously true and not
intended. Correct the intent by comparing the iterator range from member
begin and end with the iterator range from the input used to construct
the `span` - this is in line with the rest of the tests in this file.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D109668

Files:
  libcxx/test/std/containers/views/span.cons/deduct.pass.cpp


Index: libcxx/test/std/containers/views/span.cons/deduct.pass.cpp
===================================================================
--- libcxx/test/std/containers/views/span.cons/deduct.pass.cpp
+++ libcxx/test/std/containers/views/span.cons/deduct.pass.cpp
@@ -72,7 +72,7 @@
     using S = decltype(s);
     ASSERT_SAME_TYPE(S, std::span<char>);
     assert((size_t)s.size() == str.size());
-    assert((std::equal(s.begin(), s.end(), std::begin(s), std::end(s))));
+    assert((std::equal(s.begin(), s.end(), str.begin(), str.end())));
     }
 
     {
@@ -81,7 +81,7 @@
     using S = decltype(s);
     ASSERT_SAME_TYPE(S, std::span<const char>);
     assert((size_t)s.size() == str.size());
-    assert((std::equal(s.begin(), s.end(), std::begin(s), std::end(s))));
+    assert((std::equal(s.begin(), s.end(), str.begin(), str.end())));
     }
 
   return 0;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D109668.372146.patch
Type: text/x-patch
Size: 864 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20210913/e6ca8a87/attachment.bin>


More information about the libcxx-commits mailing list