[libcxx-commits] [libcxx] [libc++][test] Improve `fold_left` `check_lvalue_range` coverage. (PR #183990)

Connector Switch via libcxx-commits libcxx-commits at lists.llvm.org
Sat Mar 7 23:14:14 PST 2026


https://github.com/c8ef updated https://github.com/llvm/llvm-project/pull/183990

>From d09aece0ad512e414b7c5285ecc5286737635216 Mon Sep 17 00:00:00 2001
From: c8ef <c8ef at outlook.com>
Date: Sun, 1 Mar 2026 16:44:27 +0800
Subject: [PATCH] improve fold_left test

---
 .../alg.nonmodifying/alg.fold/left_folds.pass.cpp        | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/libcxx/test/std/algorithms/alg.nonmodifying/alg.fold/left_folds.pass.cpp b/libcxx/test/std/algorithms/alg.nonmodifying/alg.fold/left_folds.pass.cpp
index 107e09a63c96f..e08d54c597853 100644
--- a/libcxx/test/std/algorithms/alg.nonmodifying/alg.fold/left_folds.pass.cpp
+++ b/libcxx/test/std/algorithms/alg.nonmodifying/alg.fold/left_folds.pass.cpp
@@ -116,10 +116,11 @@ constexpr void check_lvalue_range(R& r, T const& init, F f, Expected const& expe
   }
 
   {
-    auto telemetry                               = invocable_telemetry();
-    auto f2                                      = invocable_with_telemetry(f, telemetry);
-    std::same_as<Expected> decltype(auto) result = fold_left(r, init, f2);
-    assert(result == expected);
+    auto telemetry                                        = invocable_telemetry();
+    auto f2                                               = invocable_with_telemetry(f, telemetry);
+    is_in_value_result<R, Expected> decltype(auto) result = fold_left_with_iter(r, init, f2);
+    assert(result.in == r.end());
+    assert(result.value == expected);
     assert(telemetry.invocations == std::ranges::distance(r));
     assert(telemetry.moves == 0);
     assert(telemetry.copies == 1);



More information about the libcxx-commits mailing list