[libcxx-commits] [libcxx] 9de882f - [libc++][NFC] Refactor tests for transform_view

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Tue Aug 17 06:21:41 PDT 2021


Author: Louis Dionne
Date: 2021-08-17T09:21:35-04:00
New Revision: 9de882fdbf7436c9ddd9b35b335ec91a524353a5

URL: https://github.com/llvm/llvm-project/commit/9de882fdbf7436c9ddd9b35b335ec91a524353a5
DIFF: https://github.com/llvm/llvm-project/commit/9de882fdbf7436c9ddd9b35b335ec91a524353a5.diff

LOG: [libc++][NFC] Refactor tests for transform_view

Adjust the names of helper function objects to represent better what
they do, as suggested in the review of D107098.

Added: 
    

Modified: 
    libcxx/test/std/ranges/range.adaptors/range.transform/base.pass.cpp
    libcxx/test/std/ranges/range.adaptors/range.transform/begin.pass.cpp
    libcxx/test/std/ranges/range.adaptors/range.transform/ctad.compile.pass.cpp
    libcxx/test/std/ranges/range.adaptors/range.transform/end.pass.cpp
    libcxx/test/std/ranges/range.adaptors/range.transform/general.pass.cpp
    libcxx/test/std/ranges/range.adaptors/range.transform/iterator/arithmetic.pass.cpp
    libcxx/test/std/ranges/range.adaptors/range.transform/iterator/base.pass.cpp
    libcxx/test/std/ranges/range.adaptors/range.transform/iterator/compare.pass.cpp
    libcxx/test/std/ranges/range.adaptors/range.transform/iterator/ctor.pass.cpp
    libcxx/test/std/ranges/range.adaptors/range.transform/iterator/deref.pass.cpp
    libcxx/test/std/ranges/range.adaptors/range.transform/iterator/iter_move.pass.cpp
    libcxx/test/std/ranges/range.adaptors/range.transform/iterator/plus_minus.pass.cpp
    libcxx/test/std/ranges/range.adaptors/range.transform/iterator/requirements.compile.pass.cpp
    libcxx/test/std/ranges/range.adaptors/range.transform/iterator/sentinel.pass.cpp
    libcxx/test/std/ranges/range.adaptors/range.transform/iterator/subscript.pass.cpp
    libcxx/test/std/ranges/range.adaptors/range.transform/iterator/types.pass.cpp
    libcxx/test/std/ranges/range.adaptors/range.transform/size.pass.cpp
    libcxx/test/std/ranges/range.adaptors/range.transform/types.h

Removed: 
    


################################################################################
diff  --git a/libcxx/test/std/ranges/range.adaptors/range.transform/base.pass.cpp b/libcxx/test/std/ranges/range.adaptors/range.transform/base.pass.cpp
index 882e1623dda7d..6e9572d12ada4 100644
--- a/libcxx/test/std/ranges/range.adaptors/range.transform/base.pass.cpp
+++ b/libcxx/test/std/ranges/range.adaptors/range.transform/base.pass.cpp
@@ -20,14 +20,14 @@
 
 constexpr bool test() {
   {
-    std::ranges::transform_view<ContiguousView, Increment> transformView;
+    std::ranges::transform_view<ContiguousView, PlusOne> transformView;
     ContiguousView base = std::move(transformView).base();
     ASSERT_SAME_TYPE(ContiguousView, decltype(std::move(transformView).base()));
     assert(std::ranges::begin(base) == globalBuff);
   }
 
   {
-    std::ranges::transform_view<CopyableView, Increment> transformView;
+    std::ranges::transform_view<CopyableView, PlusOne> transformView;
     CopyableView base1 = transformView.base();
     ASSERT_SAME_TYPE(CopyableView, decltype(transformView.base()));
     assert(std::ranges::begin(base1) == globalBuff);
@@ -38,7 +38,7 @@ constexpr bool test() {
   }
 
   {
-    const std::ranges::transform_view<CopyableView, Increment> transformView;
+    const std::ranges::transform_view<CopyableView, PlusOne> transformView;
     const CopyableView base1 = transformView.base();
     ASSERT_SAME_TYPE(CopyableView, decltype(transformView.base()));
     assert(std::ranges::begin(base1) == globalBuff);

diff  --git a/libcxx/test/std/ranges/range.adaptors/range.transform/begin.pass.cpp b/libcxx/test/std/ranges/range.adaptors/range.transform/begin.pass.cpp
index 48232c5218613..b4665a5b74f49 100644
--- a/libcxx/test/std/ranges/range.adaptors/range.transform/begin.pass.cpp
+++ b/libcxx/test/std/ranges/range.adaptors/range.transform/begin.pass.cpp
@@ -27,29 +27,29 @@ constexpr bool test() {
   int buff[8] = {0, 1, 2, 3, 4, 5, 6, 7};
 
   {
-    std::ranges::transform_view transformView(ContiguousView{buff}, Increment{});
+    std::ranges::transform_view transformView(ContiguousView{buff}, PlusOneMutable{});
     assert(transformView.begin().base() == buff);
     assert(*transformView.begin() == 1);
   }
 
   {
-    std::ranges::transform_view transformView(ForwardView{buff}, Increment{});
+    std::ranges::transform_view transformView(ForwardView{buff}, PlusOneMutable{});
     assert(transformView.begin().base().base() == buff);
     assert(*transformView.begin() == 1);
   }
 
   {
-    std::ranges::transform_view transformView(InputView{buff}, Increment{});
+    std::ranges::transform_view transformView(InputView{buff}, PlusOneMutable{});
     assert(transformView.begin().base().base() == buff);
     assert(*transformView.begin() == 1);
   }
 
   {
-    const std::ranges::transform_view transformView(ContiguousView{buff}, IncrementConst{});
+    const std::ranges::transform_view transformView(ContiguousView{buff}, PlusOne{});
     assert(*transformView.begin() == 1);
   }
 
-  static_assert(!BeginInvocable<const std::ranges::transform_view<ContiguousView, Increment>>);
+  static_assert(!BeginInvocable<const std::ranges::transform_view<ContiguousView, PlusOneMutable>>);
 
   return true;
 }

diff  --git a/libcxx/test/std/ranges/range.adaptors/range.transform/ctad.compile.pass.cpp b/libcxx/test/std/ranges/range.adaptors/range.transform/ctad.compile.pass.cpp
index c6da9f2e00c54..c07c79452d956 100644
--- a/libcxx/test/std/ranges/range.adaptors/range.transform/ctad.compile.pass.cpp
+++ b/libcxx/test/std/ranges/range.adaptors/range.transform/ctad.compile.pass.cpp
@@ -18,9 +18,9 @@
 #include "test_macros.h"
 #include "types.h"
 
-static_assert(std::same_as<decltype(std::ranges::transform_view(InputView(), Increment())),
-                           std::ranges::transform_view<InputView, Increment>>);
-static_assert(std::same_as<decltype(std::ranges::transform_view(std::declval<ForwardRange&>(), Increment())),
-                           std::ranges::transform_view<std::ranges::ref_view<ForwardRange>, Increment>>);
-static_assert(std::same_as<decltype(std::ranges::transform_view(BorrowableRange(), Increment())),
-                           std::ranges::transform_view<std::ranges::subrange<int*>, Increment>>);
+static_assert(std::same_as<decltype(std::ranges::transform_view(InputView(), PlusOne())),
+                           std::ranges::transform_view<InputView, PlusOne>>);
+static_assert(std::same_as<decltype(std::ranges::transform_view(std::declval<ForwardRange&>(), PlusOne())),
+                           std::ranges::transform_view<std::ranges::ref_view<ForwardRange>, PlusOne>>);
+static_assert(std::same_as<decltype(std::ranges::transform_view(BorrowableRange(), PlusOne())),
+                           std::ranges::transform_view<std::ranges::subrange<int*>, PlusOne>>);

diff  --git a/libcxx/test/std/ranges/range.adaptors/range.transform/end.pass.cpp b/libcxx/test/std/ranges/range.adaptors/range.transform/end.pass.cpp
index 931906353e44a..9c11ef6469b6f 100644
--- a/libcxx/test/std/ranges/range.adaptors/range.transform/end.pass.cpp
+++ b/libcxx/test/std/ranges/range.adaptors/range.transform/end.pass.cpp
@@ -32,36 +32,36 @@ concept EndIsIter = requires(T t) { ++t.end(); };
 
 constexpr bool test() {
   {
-    std::ranges::transform_view transformView(ContiguousView{}, Increment{});
+    std::ranges::transform_view transformView(ContiguousView{}, PlusOneMutable{});
     assert(transformView.end().base() == globalBuff + 8);
   }
 
   {
-    std::ranges::transform_view transformView(ForwardView{}, Increment{});
+    std::ranges::transform_view transformView(ForwardView{}, PlusOneMutable{});
     assert(transformView.end().base().base() == globalBuff + 8);
   }
 
   {
-    std::ranges::transform_view transformView(InputView{}, Increment{});
+    std::ranges::transform_view transformView(InputView{}, PlusOneMutable{});
     assert(transformView.end().base() == globalBuff + 8);
   }
 
   {
-    const std::ranges::transform_view transformView(ContiguousView{}, IncrementConst{});
+    const std::ranges::transform_view transformView(ContiguousView{}, PlusOne{});
     assert(transformView.end().base() == globalBuff + 8);
   }
 
-  static_assert(!EndInvocable<const std::ranges::transform_view<ContiguousView, Increment>>);
-  static_assert( EndInvocable<      std::ranges::transform_view<ContiguousView, Increment>>);
-  static_assert( EndInvocable<const std::ranges::transform_view<ContiguousView, IncrementConst>>);
-  static_assert(!EndInvocable<const std::ranges::transform_view<InputView, Increment>>);
-  static_assert( EndInvocable<      std::ranges::transform_view<InputView, Increment>>);
-  static_assert( EndInvocable<const std::ranges::transform_view<InputView, IncrementConst>>);
+  static_assert(!EndInvocable<const std::ranges::transform_view<ContiguousView, PlusOneMutable>>);
+  static_assert( EndInvocable<      std::ranges::transform_view<ContiguousView, PlusOneMutable>>);
+  static_assert( EndInvocable<const std::ranges::transform_view<ContiguousView, PlusOne>>);
+  static_assert(!EndInvocable<const std::ranges::transform_view<InputView, PlusOneMutable>>);
+  static_assert( EndInvocable<      std::ranges::transform_view<InputView, PlusOneMutable>>);
+  static_assert( EndInvocable<const std::ranges::transform_view<InputView, PlusOne>>);
 
-  static_assert(!EndIsIter<const std::ranges::transform_view<InputView, IncrementConst>>);
-  static_assert(!EndIsIter<      std::ranges::transform_view<InputView, Increment>>);
-  static_assert( EndIsIter<const std::ranges::transform_view<ContiguousView, IncrementConst>>);
-  static_assert( EndIsIter<      std::ranges::transform_view<ContiguousView, Increment>>);
+  static_assert(!EndIsIter<const std::ranges::transform_view<InputView, PlusOne>>);
+  static_assert(!EndIsIter<      std::ranges::transform_view<InputView, PlusOneMutable>>);
+  static_assert( EndIsIter<const std::ranges::transform_view<ContiguousView, PlusOne>>);
+  static_assert( EndIsIter<      std::ranges::transform_view<ContiguousView, PlusOneMutable>>);
 
   return true;
 }

diff  --git a/libcxx/test/std/ranges/range.adaptors/range.transform/general.pass.cpp b/libcxx/test/std/ranges/range.adaptors/range.transform/general.pass.cpp
index 9df8be1fe8275..aec7143903e4e 100644
--- a/libcxx/test/std/ranges/range.adaptors/range.transform/general.pass.cpp
+++ b/libcxx/test/std/ranges/range.adaptors/range.transform/general.pass.cpp
@@ -32,8 +32,8 @@ template<class T, class F>
 concept ValidTransformView = requires { typename std::ranges::transform_view<T, F>; };
 
 struct BadFunction { };
-static_assert( ValidTransformView<ContiguousView, Increment>);
-static_assert(!ValidTransformView<Range, Increment>);
+static_assert( ValidTransformView<ContiguousView, PlusOne>);
+static_assert(!ValidTransformView<Range, PlusOne>);
 static_assert(!ValidTransformView<ContiguousView, BadFunction>);
 
 template<std::ranges::range R>

diff  --git a/libcxx/test/std/ranges/range.adaptors/range.transform/iterator/arithmetic.pass.cpp b/libcxx/test/std/ranges/range.adaptors/range.transform/iterator/arithmetic.pass.cpp
index ad4b554bcc3df..cde7431bd82a6 100644
--- a/libcxx/test/std/ranges/range.adaptors/range.transform/iterator/arithmetic.pass.cpp
+++ b/libcxx/test/std/ranges/range.adaptors/range.transform/iterator/arithmetic.pass.cpp
@@ -18,7 +18,7 @@
 #include "../types.h"
 
 constexpr bool test() {
-  std::ranges::transform_view<ContiguousView, Increment> transformView;
+  std::ranges::transform_view<ContiguousView, PlusOne> transformView;
   auto iter = std::move(transformView).begin();
   assert((++iter).base() == globalBuff + 1);
 
@@ -31,7 +31,7 @@ constexpr bool test() {
 
   // Check that decltype(InputIter++) == void.
   ASSERT_SAME_TYPE(decltype(
-    std::declval<std::ranges::iterator_t<std::ranges::transform_view<InputView, Increment>>>()++),
+    std::declval<std::ranges::iterator_t<std::ranges::transform_view<InputView, PlusOne>>>()++),
     void);
 
   assert((iter += 4).base() == globalBuff + 4);

diff  --git a/libcxx/test/std/ranges/range.adaptors/range.transform/iterator/base.pass.cpp b/libcxx/test/std/ranges/range.adaptors/range.transform/iterator/base.pass.cpp
index c1ecad20e706b..f60ed2a5c8214 100644
--- a/libcxx/test/std/ranges/range.adaptors/range.transform/iterator/base.pass.cpp
+++ b/libcxx/test/std/ranges/range.adaptors/range.transform/iterator/base.pass.cpp
@@ -24,7 +24,7 @@ concept BaseInvocable = requires(std::ranges::iterator_t<std::ranges::transform_
 
 constexpr bool test() {
   {
-    std::ranges::transform_view<ContiguousView, Increment> transformView;
+    std::ranges::transform_view<ContiguousView, PlusOneMutable> transformView;
     auto iter = std::move(transformView).begin();
     ASSERT_SAME_TYPE(int*, decltype(iter.base()));
     assert(iter.base() == globalBuff);
@@ -33,13 +33,13 @@ constexpr bool test() {
   }
 
   {
-    std::ranges::transform_view<InputView, Increment> transformView;
+    std::ranges::transform_view<InputView, PlusOneMutable> transformView;
     auto iter = transformView.begin();
     assert(std::move(iter).base() == globalBuff);
     ASSERT_SAME_TYPE(cpp20_input_iterator<int *>, decltype(std::move(iter).base()));
   }
 
-  static_assert(!BaseInvocable<InputView, Increment>);
+  static_assert(!BaseInvocable<InputView, PlusOneMutable>);
 
   return true;
 }

diff  --git a/libcxx/test/std/ranges/range.adaptors/range.transform/iterator/compare.pass.cpp b/libcxx/test/std/ranges/range.adaptors/range.transform/iterator/compare.pass.cpp
index 5f734a819a38a..a6d0a5fbed8f1 100644
--- a/libcxx/test/std/ranges/range.adaptors/range.transform/iterator/compare.pass.cpp
+++ b/libcxx/test/std/ranges/range.adaptors/range.transform/iterator/compare.pass.cpp
@@ -20,9 +20,9 @@
 
 constexpr bool test() {
   {
-    std::ranges::transform_view<ContiguousView, Increment> transformView1;
+    std::ranges::transform_view<ContiguousView, PlusOne> transformView1;
     auto iter1 = std::move(transformView1).begin();
-    std::ranges::transform_view<ContiguousView, Increment> transformView2;
+    std::ranges::transform_view<ContiguousView, PlusOne> transformView2;
     auto iter2 = std::move(transformView2).begin();
     assert(iter1 == iter2);
     assert(iter1 + 1 != iter2);
@@ -39,9 +39,9 @@ constexpr bool test() {
 // TODO: when three_way_comparable is implemented and std::is_eq is implemented,
 // uncomment this.
 //   {
-//     std::ranges::transform_view<ThreeWayCompView, Increment> transformView1;
+//     std::ranges::transform_view<ThreeWayCompView, PlusOne> transformView1;
 //     auto iter1 = transformView1.begin();
-//     std::ranges::transform_view<ThreeWayCompView, Increment> transformView2;
+//     std::ranges::transform_view<ThreeWayCompView, PlusOne> transformView2;
 //     auto iter2 = transformView2.begin();
 //
 //     assert(std::is_eq(iter1   <=> iter2));
@@ -52,8 +52,8 @@ constexpr bool test() {
 //     assert(std::is_gt(iter2   <=> iter1));
 //     assert(std::is_gteq(iter2 <=> iter1));
 //
-//     static_assert( std::three_way_comparable<std::iterator_t<std::ranges::transform_view<ThreeWayCompView, Increment>>>);
-//     static_assert(!std::three_way_comparable<std::iterator_t<std::ranges::transform_view<ContiguousView, Increment>>>);
+//     static_assert( std::three_way_comparable<std::iterator_t<std::ranges::transform_view<ThreeWayCompView, PlusOne>>>);
+//     static_assert(!std::three_way_comparable<std::iterator_t<std::ranges::transform_view<ContiguousView, PlusOne>>>);
 //   }
 
   return true;

diff  --git a/libcxx/test/std/ranges/range.adaptors/range.transform/iterator/ctor.pass.cpp b/libcxx/test/std/ranges/range.adaptors/range.transform/iterator/ctor.pass.cpp
index f96b8e0b36f47..5e333f8d8d1f5 100644
--- a/libcxx/test/std/ranges/range.adaptors/range.transform/iterator/ctor.pass.cpp
+++ b/libcxx/test/std/ranges/range.adaptors/range.transform/iterator/ctor.pass.cpp
@@ -57,16 +57,16 @@ struct IterNoDefaultInitView : std::ranges::view_base {
 };
 
 constexpr bool test() {
-  std::ranges::transform_view<ContiguousView, IncrementConst> transformView;
+  std::ranges::transform_view<ContiguousView, PlusOne> transformView;
   auto iter = std::move(transformView).begin();
-  std::ranges::iterator_t<std::ranges::transform_view<ContiguousView, IncrementConst>> i2(iter);
+  std::ranges::iterator_t<std::ranges::transform_view<ContiguousView, PlusOne>> i2(iter);
   (void)i2;
-  std::ranges::iterator_t<const std::ranges::transform_view<ContiguousView, IncrementConst>> constIter(iter);
+  std::ranges::iterator_t<const std::ranges::transform_view<ContiguousView, PlusOne>> constIter(iter);
   (void)constIter;
 
 
-  static_assert( std::default_initializable<std::ranges::iterator_t<std::ranges::transform_view<ContiguousView, IncrementConst>>>);
-  static_assert(!std::default_initializable<std::ranges::iterator_t<std::ranges::transform_view<IterNoDefaultInitView, IncrementConst>>>);
+  static_assert( std::default_initializable<std::ranges::iterator_t<std::ranges::transform_view<ContiguousView, PlusOne>>>);
+  static_assert(!std::default_initializable<std::ranges::iterator_t<std::ranges::transform_view<IterNoDefaultInitView, PlusOne>>>);
 
   return true;
 }

diff  --git a/libcxx/test/std/ranges/range.adaptors/range.transform/iterator/deref.pass.cpp b/libcxx/test/std/ranges/range.adaptors/range.transform/iterator/deref.pass.cpp
index 2dc761f156c76..f1bc26d152a5c 100644
--- a/libcxx/test/std/ranges/range.adaptors/range.transform/iterator/deref.pass.cpp
+++ b/libcxx/test/std/ranges/range.adaptors/range.transform/iterator/deref.pass.cpp
@@ -18,27 +18,46 @@
 #include "../types.h"
 
 int main(int, char**) {
-  int buff[8] = {0, 1, 2, 3, 4, 5, 6, 7};
-
   {
-    std::ranges::transform_view transformView(ContiguousView{buff}, Increment{});
+    int buff[] = {0, 1, 2, 3, 4, 5, 6, 7};
+    using View = std::ranges::transform_view<ContiguousView, PlusOne>;
+    View transformView(ContiguousView{buff}, PlusOne{});
     assert(*transformView.begin() == 1);
+    static_assert(!noexcept(*std::declval<std::ranges::iterator_t<View>>()));
+    ASSERT_SAME_TYPE(int, decltype(*std::declval<View>().begin()));
+  }
+  {
+    int buff[] = {0, 1, 2, 3, 4, 5, 6, 7};
+    using View = std::ranges::transform_view<ContiguousView, PlusOneMutable>;
+    View transformView(ContiguousView{buff}, PlusOneMutable{});
+    assert(*transformView.begin() == 1);
+    static_assert(!noexcept(*std::declval<std::ranges::iterator_t<View>>()));
+    ASSERT_SAME_TYPE(int, decltype(*std::declval<View>().begin()));
+  }
+  {
+    int buff[] = {0, 1, 2, 3, 4, 5, 6, 7};
+    using View = std::ranges::transform_view<ContiguousView, PlusOneNoexcept>;
+    View transformView(ContiguousView{buff}, PlusOneNoexcept{});
+    assert(*transformView.begin() == 1);
+    static_assert(noexcept(*std::declval<std::ranges::iterator_t<View>>()));
+    ASSERT_SAME_TYPE(int, decltype(*std::declval<View>().begin()));
+  }
+  {
+    int buff[] = {0, 1, 2, 3, 4, 5, 6, 7};
+    using View = std::ranges::transform_view<ContiguousView, Increment>;
+    View transformView(ContiguousView{buff}, Increment{});
+    assert(*transformView.begin() == 1);
+    static_assert(!noexcept(*std::declval<std::ranges::iterator_t<View>>()));
+    ASSERT_SAME_TYPE(int&, decltype(*std::declval<View>().begin()));
+  }
+  {
+    int buff[] = {0, 1, 2, 3, 4, 5, 6, 7};
+    using View = std::ranges::transform_view<ContiguousView, IncrementRvalueRef>;
+    View transformView(ContiguousView{buff}, IncrementRvalueRef{});
+    assert(*transformView.begin() == 1);
+    static_assert(!noexcept(*std::declval<std::ranges::iterator_t<View>>()));
+    ASSERT_SAME_TYPE(int&&, decltype(*std::declval<View>().begin()));
   }
-
-  static_assert(!noexcept(
-    *std::declval<std::ranges::iterator_t<std::ranges::transform_view<ContiguousView, Increment>>>()));
-  static_assert( noexcept(
-    *std::declval<std::ranges::iterator_t<std::ranges::transform_view<ContiguousView, IncrementNoexcept>>>()));
-
-  ASSERT_SAME_TYPE(
-    int,
-    decltype(*std::declval<std::ranges::transform_view<RandomAccessView, Increment>>().begin()));
-  ASSERT_SAME_TYPE(
-    int&,
-    decltype(*std::declval<std::ranges::transform_view<RandomAccessView, IncrementRef>>().begin()));
-  ASSERT_SAME_TYPE(
-    int&&,
-    decltype(*std::declval<std::ranges::transform_view<RandomAccessView, IncrementRvalueRef>>().begin()));
 
   return 0;
 }

diff  --git a/libcxx/test/std/ranges/range.adaptors/range.transform/iterator/iter_move.pass.cpp b/libcxx/test/std/ranges/range.adaptors/range.transform/iterator/iter_move.pass.cpp
index 68663785d4ca8..85a46d99e4904 100644
--- a/libcxx/test/std/ranges/range.adaptors/range.transform/iterator/iter_move.pass.cpp
+++ b/libcxx/test/std/ranges/range.adaptors/range.transform/iterator/iter_move.pass.cpp
@@ -21,7 +21,7 @@ constexpr bool test() {
   int buff[8] = {0, 1, 2, 3, 4, 5, 6, 7};
 
   {
-    std::ranges::transform_view transformView(ContiguousView{buff}, Increment{});
+    std::ranges::transform_view transformView(ContiguousView{buff}, PlusOneMutable{});
     auto iter = transformView.begin();
     static_assert(!noexcept(std::ranges::iter_move(iter)));
 
@@ -34,9 +34,9 @@ constexpr bool test() {
 
   {
     static_assert( noexcept(std::ranges::iter_move(
-      std::declval<std::ranges::iterator_t<std::ranges::transform_view<ContiguousView, IncrementNoexcept>>&>())));
+      std::declval<std::ranges::iterator_t<std::ranges::transform_view<ContiguousView, PlusOneNoexcept>>&>())));
     static_assert(!noexcept(std::ranges::iter_move(
-      std::declval<std::ranges::iterator_t<std::ranges::transform_view<ContiguousView, Increment>>&>())));
+      std::declval<std::ranges::iterator_t<std::ranges::transform_view<ContiguousView, PlusOneMutable>>&>())));
   }
 
   return true;

diff  --git a/libcxx/test/std/ranges/range.adaptors/range.transform/iterator/plus_minus.pass.cpp b/libcxx/test/std/ranges/range.adaptors/range.transform/iterator/plus_minus.pass.cpp
index a003945b9f23a..4a97d75958a9c 100644
--- a/libcxx/test/std/ranges/range.adaptors/range.transform/iterator/plus_minus.pass.cpp
+++ b/libcxx/test/std/ranges/range.adaptors/range.transform/iterator/plus_minus.pass.cpp
@@ -18,9 +18,9 @@
 #include "../types.h"
 
 constexpr bool test() {
-  std::ranges::transform_view<ContiguousView, Increment> transformView1;
+  std::ranges::transform_view<ContiguousView, PlusOneMutable> transformView1;
   auto iter1 = std::move(transformView1).begin();
-  std::ranges::transform_view<ContiguousView, Increment> transformView2;
+  std::ranges::transform_view<ContiguousView, PlusOneMutable> transformView2;
   auto iter2 = std::move(transformView2).begin();
   iter1 += 4;
   assert((iter1 + 1).base() == globalBuff + 5);

diff  --git a/libcxx/test/std/ranges/range.adaptors/range.transform/iterator/requirements.compile.pass.cpp b/libcxx/test/std/ranges/range.adaptors/range.transform/iterator/requirements.compile.pass.cpp
index ae7485b5d215b..2932ad14a6fcc 100644
--- a/libcxx/test/std/ranges/range.adaptors/range.transform/iterator/requirements.compile.pass.cpp
+++ b/libcxx/test/std/ranges/range.adaptors/range.transform/iterator/requirements.compile.pass.cpp
@@ -17,8 +17,8 @@
 #include "test_macros.h"
 #include "../types.h"
 
-static_assert(std::ranges::bidirectional_range<std::ranges::transform_view<BidirectionalView, IncrementConst>>);
-static_assert(!std::ranges::bidirectional_range<std::ranges::transform_view<ForwardView, IncrementConst>>);
+static_assert(std::ranges::bidirectional_range<std::ranges::transform_view<BidirectionalView, PlusOne>>);
+static_assert(!std::ranges::bidirectional_range<std::ranges::transform_view<ForwardView, PlusOne>>);
 
-static_assert(std::ranges::random_access_range<std::ranges::transform_view<RandomAccessView, IncrementConst>>);
-static_assert(!std::ranges::random_access_range<std::ranges::transform_view<BidirectionalView, IncrementConst>>);
+static_assert(std::ranges::random_access_range<std::ranges::transform_view<RandomAccessView, PlusOne>>);
+static_assert(!std::ranges::random_access_range<std::ranges::transform_view<BidirectionalView, PlusOne>>);

diff  --git a/libcxx/test/std/ranges/range.adaptors/range.transform/iterator/sentinel.pass.cpp b/libcxx/test/std/ranges/range.adaptors/range.transform/iterator/sentinel.pass.cpp
index d12ece51c0c97..1c4ef28f9d38e 100644
--- a/libcxx/test/std/ranges/range.adaptors/range.transform/iterator/sentinel.pass.cpp
+++ b/libcxx/test/std/ranges/range.adaptors/range.transform/iterator/sentinel.pass.cpp
@@ -21,18 +21,18 @@ template<class T>
 concept EndIsIter = requires(T t) { ++t.end(); };
 
 constexpr bool test() {
-  std::ranges::transform_view<SizedSentinelView, IncrementConst> transformView1;
+  std::ranges::transform_view<SizedSentinelView, PlusOne> transformView1;
   // Going to const and back.
   auto sent1 = transformView1.end();
-  std::ranges::sentinel_t<const std::ranges::transform_view<SizedSentinelView, IncrementConst>> sent2{sent1};
-  std::ranges::sentinel_t<const std::ranges::transform_view<SizedSentinelView, IncrementConst>> sent3{sent2};
+  std::ranges::sentinel_t<const std::ranges::transform_view<SizedSentinelView, PlusOne>> sent2{sent1};
+  std::ranges::sentinel_t<const std::ranges::transform_view<SizedSentinelView, PlusOne>> sent3{sent2};
   (void)sent3;
 
   static_assert(!EndIsIter<decltype(sent1)>);
   static_assert(!EndIsIter<decltype(sent2)>);
   assert(sent1.base() == globalBuff + 8);
 
-  std::ranges::transform_view transformView2(SizedSentinelView{4}, IncrementConst());
+  std::ranges::transform_view transformView2(SizedSentinelView{4}, PlusOne());
   auto sent4 = transformView2.end();
   auto iter = transformView1.begin();
   {

diff  --git a/libcxx/test/std/ranges/range.adaptors/range.transform/iterator/subscript.pass.cpp b/libcxx/test/std/ranges/range.adaptors/range.transform/iterator/subscript.pass.cpp
index 90a673df15a01..567f646fbd14d 100644
--- a/libcxx/test/std/ranges/range.adaptors/range.transform/iterator/subscript.pass.cpp
+++ b/libcxx/test/std/ranges/range.adaptors/range.transform/iterator/subscript.pass.cpp
@@ -19,22 +19,22 @@
 
 constexpr bool test() {
   int buff[8] = {0, 1, 2, 3, 4, 5, 6, 7};
-  std::ranges::transform_view transformView1(ContiguousView{buff}, Increment{});
+  std::ranges::transform_view transformView1(ContiguousView{buff}, PlusOneMutable{});
   auto iter1 = std::move(transformView1).begin() + 1;
   assert(iter1[0] == 2);
   assert(iter1[4] == 6);
 
   static_assert(!noexcept(
-    std::declval<std::ranges::iterator_t<std::ranges::transform_view<ContiguousView, Increment>>>()[0]));
+    std::declval<std::ranges::iterator_t<std::ranges::transform_view<ContiguousView, PlusOneMutable>>>()[0]));
   static_assert( noexcept(
-    std::declval<std::ranges::iterator_t<std::ranges::transform_view<ContiguousView, IncrementNoexcept>>>()[0]));
+    std::declval<std::ranges::iterator_t<std::ranges::transform_view<ContiguousView, PlusOneNoexcept>>>()[0]));
 
   ASSERT_SAME_TYPE(
     int,
-    decltype(std::declval<std::ranges::transform_view<RandomAccessView, Increment>>().begin()[0]));
+    decltype(std::declval<std::ranges::transform_view<RandomAccessView, PlusOneMutable>>().begin()[0]));
   ASSERT_SAME_TYPE(
     int&,
-    decltype(std::declval<std::ranges::transform_view<RandomAccessView, IncrementRef>>().begin()[0]));
+    decltype(std::declval<std::ranges::transform_view<RandomAccessView, Increment>>().begin()[0]));
   ASSERT_SAME_TYPE(
     int&&,
     decltype(std::declval<std::ranges::transform_view<RandomAccessView, IncrementRvalueRef>>().begin()[0]));

diff  --git a/libcxx/test/std/ranges/range.adaptors/range.transform/iterator/types.pass.cpp b/libcxx/test/std/ranges/range.adaptors/range.transform/iterator/types.pass.cpp
index 7c03c47bcdc8c..de7747023f5a4 100644
--- a/libcxx/test/std/ranges/range.adaptors/range.transform/iterator/types.pass.cpp
+++ b/libcxx/test/std/ranges/range.adaptors/range.transform/iterator/types.pass.cpp
@@ -29,7 +29,7 @@ constexpr bool test() {
     static_assert(std::same_as<std::iterator_traits<int*>::iterator_concept, std::contiguous_iterator_tag>);
     static_assert(std::same_as<std::iterator_traits<int*>::iterator_category, std::random_access_iterator_tag>);
 
-    using TView = std::ranges::transform_view<ContiguousView, IncrementRef>;
+    using TView = std::ranges::transform_view<ContiguousView, Increment>;
     using TIter = std::ranges::iterator_t<TView>;
     static_assert(std::same_as<typename TIter::iterator_concept, std::random_access_iterator_tag>);
     static_assert(std::same_as<typename TIter::iterator_category, std::random_access_iterator_tag>);
@@ -38,7 +38,7 @@ constexpr bool test() {
   }
   {
     // Member typedefs for random access iterator.
-    using TView = std::ranges::transform_view<RandomAccessView, IncrementRef>;
+    using TView = std::ranges::transform_view<RandomAccessView, Increment>;
     using TIter = std::ranges::iterator_t<TView>;
     static_assert(std::same_as<typename TIter::iterator_concept, std::random_access_iterator_tag>);
     static_assert(std::same_as<typename TIter::iterator_category, std::random_access_iterator_tag>);
@@ -47,7 +47,7 @@ constexpr bool test() {
   }
   {
     // Member typedefs for random access iterator/not-lvalue-ref.
-    using TView = std::ranges::transform_view<RandomAccessView, Increment>;
+    using TView = std::ranges::transform_view<RandomAccessView, PlusOneMutable>;
     using TIter = std::ranges::iterator_t<TView>;
     static_assert(std::same_as<typename TIter::iterator_concept, std::random_access_iterator_tag>);
     static_assert(std::same_as<typename TIter::iterator_category, std::input_iterator_tag>); // Note: this is now input_iterator_tag.
@@ -56,7 +56,7 @@ constexpr bool test() {
   }
   {
     // Member typedefs for bidirectional iterator.
-    using TView = std::ranges::transform_view<BidirectionalView, IncrementRef>;
+    using TView = std::ranges::transform_view<BidirectionalView, Increment>;
     using TIter = std::ranges::iterator_t<TView>;
     static_assert(std::same_as<typename TIter::iterator_concept, std::bidirectional_iterator_tag>);
     static_assert(std::same_as<typename TIter::iterator_category, std::bidirectional_iterator_tag>);
@@ -65,7 +65,7 @@ constexpr bool test() {
   }
   {
     // Member typedefs for forward iterator.
-    using TView = std::ranges::transform_view<ForwardView, IncrementRef>;
+    using TView = std::ranges::transform_view<ForwardView, Increment>;
     using TIter = std::ranges::iterator_t<TView>;
     static_assert(std::same_as<typename TIter::iterator_concept, std::forward_iterator_tag>);
     static_assert(std::same_as<typename TIter::iterator_category, std::forward_iterator_tag>);
@@ -74,10 +74,10 @@ constexpr bool test() {
   }
   {
     // Member typedefs for input iterator.
-    using TView = std::ranges::transform_view<InputView, IncrementRef>;
+    using TView = std::ranges::transform_view<InputView, Increment>;
     using TIter = std::ranges::iterator_t<TView>;
     static_assert(std::same_as<typename TIter::iterator_concept, std::input_iterator_tag>);
-    static_assert(!HasIterCategory<InputView, IncrementRef>);
+    static_assert(!HasIterCategory<InputView, Increment>);
     static_assert(std::same_as<typename TIter::value_type, int>);
     static_assert(std::same_as<typename TIter::
diff erence_type, std::ptr
diff _t>);
   }

diff  --git a/libcxx/test/std/ranges/range.adaptors/range.transform/size.pass.cpp b/libcxx/test/std/ranges/range.adaptors/range.transform/size.pass.cpp
index d0de0e7a72c6a..0402d44f66447 100644
--- a/libcxx/test/std/ranges/range.adaptors/range.transform/size.pass.cpp
+++ b/libcxx/test/std/ranges/range.adaptors/range.transform/size.pass.cpp
@@ -23,19 +23,19 @@ concept SizeInvocable = requires(T t) { t.size(); };
 
 constexpr bool test() {
   {
-    std::ranges::transform_view transformView(ContiguousView{}, Increment{});
+    std::ranges::transform_view transformView(ContiguousView{}, PlusOne{});
     assert(transformView.size() == 8);
   }
 
   {
-    const std::ranges::transform_view transformView(ContiguousView{globalBuff, 4}, Increment{});
+    const std::ranges::transform_view transformView(ContiguousView{globalBuff, 4}, PlusOne{});
     assert(transformView.size() == 4);
   }
 
-  static_assert(!SizeInvocable<std::ranges::transform_view<ForwardView, Increment>>);
+  static_assert(!SizeInvocable<std::ranges::transform_view<ForwardView, PlusOne>>);
 
-  static_assert(SizeInvocable<std::ranges::transform_view<SizedSentinelNotConstView, Increment>>);
-  static_assert(!SizeInvocable<const std::ranges::transform_view<SizedSentinelNotConstView, Increment>>);
+  static_assert(SizeInvocable<std::ranges::transform_view<SizedSentinelNotConstView, PlusOne>>);
+  static_assert(!SizeInvocable<const std::ranges::transform_view<SizedSentinelNotConstView, PlusOne>>);
 
   return true;
 }

diff  --git a/libcxx/test/std/ranges/range.adaptors/range.transform/types.h b/libcxx/test/std/ranges/range.adaptors/range.transform/types.h
index 429a5ed969d91..159db9b4c97bf 100644
--- a/libcxx/test/std/ranges/range.adaptors/range.transform/types.h
+++ b/libcxx/test/std/ranges/range.adaptors/range.transform/types.h
@@ -129,15 +129,15 @@ struct ThreeWayCompView : std::ranges::view_base {
   constexpr ThreeWayCompIter end() const { return ThreeWayCompIter(globalBuff + 8); }
 };
 
-struct Increment {
+struct PlusOneMutable {
   constexpr int operator()(int x) { return x + 1; }
 };
 
-struct IncrementConst {
+struct PlusOne {
   constexpr int operator()(int x) const { return x + 1; }
 };
 
-struct IncrementRef {
+struct Increment {
   constexpr int& operator()(int& x) { return ++x; }
 };
 
@@ -145,7 +145,7 @@ struct IncrementRvalueRef {
   constexpr int&& operator()(int& x) { return std::move(++x); }
 };
 
-struct IncrementNoexcept {
+struct PlusOneNoexcept {
   constexpr int operator()(int x) noexcept { return x + 1; }
 };
 


        


More information about the libcxx-commits mailing list