[libc-commits] [libc] [libc] wcscspn implementation (PR #146158)
Michael Jones via libc-commits
libc-commits at lists.llvm.org
Mon Jun 30 13:09:11 PDT 2025
================
@@ -0,0 +1,68 @@
+//===-- Unittests for wcscspn
+//----------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "hdr/types/size_t.h"
+#include "hdr/types/wchar_t.h"
+#include "src/wchar/wcscspn.h"
+#include "test/UnitTest/Test.h"
+
+TEST(LlvmLibcWCSCSpnTest, EmptyStringShouldReturnZeroLengthSpan) {
+ // The search should not include the null terminator.
+ EXPECT_EQ(LIBC_NAMESPACE::wcscspn(L"", L""), size_t{0});
----------------
michaelrj-google wrote:
for initializing a size_t you can use parenthesis instead of braces, here and below.
```suggestion
EXPECT_EQ(LIBC_NAMESPACE::wcscspn(L"", L""), size_t(0));
```
https://github.com/llvm/llvm-project/pull/146158
More information about the libc-commits
mailing list