[libc-commits] [libc] [libc] wchar string conversion functions mb to wc (PR #149423)

Uzair Nawaz via libc-commits libc-commits at lists.llvm.org
Fri Jul 18 09:34:08 PDT 2025


================
@@ -0,0 +1,202 @@
+//===-- Unittests for mbsetowcs -------------------------------------------===//
+//
+// 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/mbstate_t.h"
+#include "hdr/types/wchar_t.h"
+#include "src/__support/libc_errno.h"
+#include "src/__support/wchar/mbstate.h"
+#include "src/string/memset.h"
+#include "src/wchar/mbsnrtowcs.h"
+#include "test/UnitTest/ErrnoCheckingTest.h"
+#include "test/UnitTest/Test.h"
+
+using LlvmLibcMBSNRToWCSTest = LIBC_NAMESPACE::testing::ErrnoCheckingTest;
+
+TEST_F(LlvmLibcMBSNRToWCSTest, OneByteOneChar) {
+  const char *ch = "A";
+  const char *original = ch;
+  wchar_t dest[2];
+  mbstate_t *mb;
----------------
uzairnawaz wrote:

`mb` probably shouldn't be a pointer (fix in all tests)

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


More information about the libc-commits mailing list