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

via libcxx-commits libcxx-commits at lists.llvm.org
Sat Apr 11 03:28:24 PDT 2026


Author: Connector Switch
Date: 2026-04-11T18:28:18+08:00
New Revision: 1ed2769c681e28e43ecf7f125f1ea018ec4f993b

URL: https://github.com/llvm/llvm-project/commit/1ed2769c681e28e43ecf7f125f1ea018ec4f993b
DIFF: https://github.com/llvm/llvm-project/commit/1ed2769c681e28e43ecf7f125f1ea018ec4f993b.diff

LOG: [libc++][test] Improve `fold_left` `check_lvalue_range` coverage.  (#183990)

This makes the test `fold_left` and `fold_left_with_iter` with and
without telemetrics similar to what we do in `check_iterator`.

Added: 
    

Modified: 
    libcxx/test/std/algorithms/alg.nonmodifying/alg.fold/left_folds.pass.cpp

Removed: 
    


################################################################################
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