1 | //===-- Unittests for strncasecmp_l ---------------------------------------===// |
2 | // |
3 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
4 | // See https://llvm.org/LICENSE.txt for license information. |
5 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
6 | // |
7 | //===----------------------------------------------------------------------===// |
8 | |
9 | #include "hdr/locale_macros.h" |
10 | #include "src/locale/freelocale.h" |
11 | #include "src/locale/newlocale.h" |
12 | #include "src/strings/strncasecmp_l.h" |
13 | #include "test/UnitTest/Test.h" |
14 | |
15 | TEST(LlvmLibcStrNCaseCmpLTest, Case) { |
16 | locale_t locale = LIBC_NAMESPACE::newlocale(LC_ALL, "C" , nullptr); |
17 | ASSERT_EQ(LIBC_NAMESPACE::strncasecmp_l("hello" , "HELLO" , 3, locale), 0); |
18 | ASSERT_EQ(LIBC_NAMESPACE::strncasecmp_l("abcXX" , "ABCYY" , 3, locale), 0); |
19 | ASSERT_LT(LIBC_NAMESPACE::strncasecmp_l("hello1" , "hello2" , 6, locale), 0); |
20 | ASSERT_GT(LIBC_NAMESPACE::strncasecmp_l("hello2" , "hello1" , 6, locale), 0); |
21 | LIBC_NAMESPACE::freelocale(locale); |
22 | } |
23 | |