[libc-commits] [libc] [libc] Implement `search/lsearch` (PR #131431)

via libc-commits libc-commits at lists.llvm.org
Mon Mar 17 12:00:44 PDT 2025


================
@@ -46,3 +46,25 @@ TEST(LlvmLibcLsearchTest, SearchNonExistent) {
   ASSERT_EQ(key, list[3]);
   ASSERT_EQ(len, 4UL);
 }
+
+TEST(LlvmLibcLsearchTest, SearchExceptional) {
+  int list[3] = {1, 2, 3};
+  size_t len = 3;
+  size_t max_len = ~0;
+  int key = 3;
+  void *ret_key =
----------------
lntue wrote:

nit: Does
```
ASSERT_EQ(LIBC_NAMESPACE::lsearch(nullptr, list, &len, sizeof(int), compar), nullptr);
```
work?  If so can you change the rest of them.  Thanks!

https://github.com/llvm/llvm-project/pull/131431


More information about the libc-commits mailing list