- 31d03284ca8017ba59d98d47e7d041f361d478a7 Release escaping microbenchmarks. by Alex Strelnikov <strel@google.com>
- f183ce453db49ebc1948bb1d8eced37021cf63f7 Internal change. by Derek Mauro <dmauro@google.com> - b1660cb93e0fa37cdcecf37642766f5bfd12c7b0 Improve compatibility of some cc_test targets for portabl... by Abseil Team <absl-team@google.com> GitOrigin-RevId: 31d03284ca8017ba59d98d47e7d041f361d478a7 Change-Id: I9c4c4d2ad12cfe10c914f7cfa9aaab67fcef5cb1
This commit is contained in:
parent
014f02a3ec
commit
99477fa9f1
11 changed files with 189 additions and 14 deletions
|
|
@ -130,9 +130,11 @@ TEST(AsciiIsFoo, All) {
|
|||
// Checks that absl::ascii_isfoo returns the same value as isfoo in the C
|
||||
// locale.
|
||||
TEST(AsciiIsFoo, SameAsIsFoo) {
|
||||
#ifndef __ANDROID__
|
||||
// temporarily change locale to C. It should already be C, but just for safety
|
||||
std::string old_locale = setlocale(LC_CTYPE, nullptr);
|
||||
ASSERT_TRUE(setlocale(LC_CTYPE, "C"));
|
||||
const char* old_locale = setlocale(LC_CTYPE, "C");
|
||||
ASSERT_TRUE(old_locale != nullptr);
|
||||
#endif
|
||||
|
||||
for (int i = 0; i < 256; i++) {
|
||||
EXPECT_EQ(isalpha(i) != 0, absl::ascii_isalpha(i)) << i;
|
||||
|
|
@ -150,14 +152,18 @@ TEST(AsciiIsFoo, SameAsIsFoo) {
|
|||
EXPECT_EQ(isascii(i) != 0, absl::ascii_isascii(i)) << i;
|
||||
}
|
||||
|
||||
#ifndef __ANDROID__
|
||||
// restore the old locale.
|
||||
ASSERT_TRUE(setlocale(LC_CTYPE, old_locale.c_str()));
|
||||
ASSERT_TRUE(setlocale(LC_CTYPE, old_locale));
|
||||
#endif
|
||||
}
|
||||
|
||||
TEST(AsciiToFoo, All) {
|
||||
#ifndef __ANDROID__
|
||||
// temporarily change locale to C. It should already be C, but just for safety
|
||||
std::string old_locale = setlocale(LC_CTYPE, nullptr);
|
||||
ASSERT_TRUE(setlocale(LC_CTYPE, "C"));
|
||||
const char* old_locale = setlocale(LC_CTYPE, "C");
|
||||
ASSERT_TRUE(old_locale != nullptr);
|
||||
#endif
|
||||
|
||||
for (int i = 0; i < 256; i++) {
|
||||
if (absl::ascii_islower(i))
|
||||
|
|
@ -180,9 +186,10 @@ TEST(AsciiToFoo, All) {
|
|||
EXPECT_EQ(absl::ascii_tolower(i), absl::ascii_tolower(sc)) << i;
|
||||
EXPECT_EQ(absl::ascii_toupper(i), absl::ascii_toupper(sc)) << i;
|
||||
}
|
||||
|
||||
#ifndef __ANDROID__
|
||||
// restore the old locale.
|
||||
ASSERT_TRUE(setlocale(LC_CTYPE, old_locale.c_str()));
|
||||
ASSERT_TRUE(setlocale(LC_CTYPE, old_locale));
|
||||
#endif
|
||||
}
|
||||
|
||||
TEST(AsciiStrTo, Lower) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue