• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #include <gtest/gtest.h>
2 #include <locale.h>
3 
4 using namespace testing::ext;
5 
6 class LocaleNewlocaleTest : public testing::Test {
SetUp()7     void SetUp() override {}
TearDown()8     void TearDown() override {}
9 };
10 
11 extern "C" locale_t __newlocale(int mask, const char* name, locale_t loc);
12 
13 /**
14  * @tc.name: __newlocale_001
15  * @tc.desc: This test verifies that when the current region is set to "en_US.utf8", the call__newlocale function
16  *           successfully sets the region to "fr-FR. utf8". The expected outcome is__newlocale function returns a value
17  *           of 0, indicating a failure to set the region.
18  * @tc.type: FUNC
19  */
20 HWTEST_F(LocaleNewlocaleTest, __newlocale_001, TestSize.Level1)
21 {
22     setlocale(LC_ALL, "en_US.utf8");
23     locale_t newLoc = __newlocale(LC_ALL, "fr_FR.utf8", nullptr);
24     EXPECT_TRUE(newLoc == nullptr);
25     if (newLoc != nullptr) {
26         freelocale(newLoc);
27     }
28 }