1 | //===-- Unittests for locale ----------------------------------------------===// |
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/locale/uselocale.h" |
13 | #include "test/UnitTest/Test.h" |
14 | |
15 | TEST(LlvmLibcLocale, DefaultLocale) { |
16 | locale_t new_locale = LIBC_NAMESPACE::newlocale(LC_ALL, "C" , nullptr); |
17 | EXPECT_NE(new_locale, static_cast<locale_t>(nullptr)); |
18 | |
19 | locale_t old_locale = LIBC_NAMESPACE::uselocale(new_locale); |
20 | EXPECT_NE(old_locale, static_cast<locale_t>(nullptr)); |
21 | |
22 | LIBC_NAMESPACE::freelocale(new_locale); |
23 | |
24 | LIBC_NAMESPACE::uselocale(old_locale); |
25 | } |
26 | |