diff options
Diffstat (limited to 'libc/test/src/ctype/tolower_test.cpp')
-rw-r--r-- | libc/test/src/ctype/tolower_test.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/libc/test/src/ctype/tolower_test.cpp b/libc/test/src/ctype/tolower_test.cpp new file mode 100644 index 000000000000..096ef969bf63 --- /dev/null +++ b/libc/test/src/ctype/tolower_test.cpp @@ -0,0 +1,20 @@ +//===-- Unittests for tolower----------------------------------------------===// +// +// 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 "src/ctype/tolower.h" +#include "utils/UnitTest/Test.h" + +TEST(ToLower, DefaultLocale) { + for (int ch = 0; ch < 255; ++ch) { + // This follows pattern 'A' + 32 = 'a'. + if ('A' <= ch && ch <= 'Z') + EXPECT_EQ(__llvm_libc::tolower(ch), ch + 32); + else + EXPECT_EQ(__llvm_libc::tolower(ch), ch); + } +} |