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