Skip to content

Commit 99798dc

Browse files
committed
More tweaks
1 parent 134cdfe commit 99798dc

File tree

1 file changed

+87
-87
lines changed

1 file changed

+87
-87
lines changed

tests/yup_core/yup_CharacterFunctions.cpp

Lines changed: 87 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -428,26 +428,26 @@ TEST (CharacterFunctionsGeneralTests, ToUpperCase)
428428
EXPECT_EQ (CharacterFunctions::toUpperCase ('!'), '!');
429429

430430
// Latin-1 Supplement
431-
EXPECT_EQ (CharacterFunctions::toUpperCase (L'à'), L'À');
432-
EXPECT_EQ (CharacterFunctions::toUpperCase (L'é'), L'É');
433-
EXPECT_EQ (CharacterFunctions::toUpperCase (L'ñ'), L'Ñ');
434-
EXPECT_EQ (CharacterFunctions::toUpperCase (L'ÿ'), L'Ÿ');
431+
EXPECT_EQ (CharacterFunctions::toUpperCase (U'à'), U'À');
432+
EXPECT_EQ (CharacterFunctions::toUpperCase (U'é'), U'É');
433+
EXPECT_EQ (CharacterFunctions::toUpperCase (U'ñ'), U'Ñ');
434+
EXPECT_EQ (CharacterFunctions::toUpperCase (U'ÿ'), U'Ÿ');
435435

436436
// Latin Extended
437-
EXPECT_EQ (CharacterFunctions::toUpperCase (L'ā'), L'Ā');
438-
EXPECT_EQ (CharacterFunctions::toUpperCase (L'ě'), L'Ě');
439-
EXPECT_EQ (CharacterFunctions::toUpperCase (L'ő'), L'Ő');
437+
EXPECT_EQ (CharacterFunctions::toUpperCase (U'ā'), U'Ā');
438+
EXPECT_EQ (CharacterFunctions::toUpperCase (U'ě'), U'Ě');
439+
EXPECT_EQ (CharacterFunctions::toUpperCase (U'ő'), U'Ő');
440440

441441
// Greek
442-
EXPECT_EQ (CharacterFunctions::toUpperCase (L'α'), L'Α');
443-
EXPECT_EQ (CharacterFunctions::toUpperCase (L'ω'), L'Ω');
442+
EXPECT_EQ (CharacterFunctions::toUpperCase (U'α'), U'Α');
443+
EXPECT_EQ (CharacterFunctions::toUpperCase (U'ω'), U'Ω');
444444

445445
// Cyrillic
446-
EXPECT_EQ (CharacterFunctions::toUpperCase (L'а'), L'А');
447-
EXPECT_EQ (CharacterFunctions::toUpperCase (L'я'), L'Я');
446+
EXPECT_EQ (CharacterFunctions::toUpperCase (U'а'), U'А');
447+
EXPECT_EQ (CharacterFunctions::toUpperCase (U'я'), U'Я');
448448

449449
// Special case: dotless i
450-
EXPECT_EQ (CharacterFunctions::toUpperCase (L'ı'), L'I');
450+
EXPECT_EQ (CharacterFunctions::toUpperCase (U'ı'), U'I');
451451
}
452452

453453
TEST (CharacterFunctionsGeneralTests, ToLowerCase)
@@ -461,26 +461,26 @@ TEST (CharacterFunctionsGeneralTests, ToLowerCase)
461461
EXPECT_EQ (CharacterFunctions::toLowerCase ('!'), '!');
462462

463463
// Latin-1 Supplement
464-
EXPECT_EQ (CharacterFunctions::toLowerCase (L'À'), L'à');
465-
EXPECT_EQ (CharacterFunctions::toLowerCase (L'É'), L'é');
466-
EXPECT_EQ (CharacterFunctions::toLowerCase (L'Ñ'), L'ñ');
467-
EXPECT_EQ (CharacterFunctions::toLowerCase (L'Ÿ'), L'ÿ');
464+
EXPECT_EQ (CharacterFunctions::toLowerCase (U'À'), U'à');
465+
EXPECT_EQ (CharacterFunctions::toLowerCase (U'É'), U'é');
466+
EXPECT_EQ (CharacterFunctions::toLowerCase (U'Ñ'), U'ñ');
467+
EXPECT_EQ (CharacterFunctions::toLowerCase (U'Ÿ'), U'ÿ');
468468

469469
// Latin Extended
470-
EXPECT_EQ (CharacterFunctions::toLowerCase (L'Ā'), L'ā');
471-
EXPECT_EQ (CharacterFunctions::toLowerCase (L'Ě'), L'ě');
472-
EXPECT_EQ (CharacterFunctions::toLowerCase (L'Ő'), L'ő');
470+
EXPECT_EQ (CharacterFunctions::toLowerCase (U'Ā'), U'ā');
471+
EXPECT_EQ (CharacterFunctions::toLowerCase (U'Ě'), U'ě');
472+
EXPECT_EQ (CharacterFunctions::toLowerCase (U'Ő'), U'ő');
473473

474474
// Greek
475-
EXPECT_EQ (CharacterFunctions::toLowerCase (L'Α'), L'α');
476-
EXPECT_EQ (CharacterFunctions::toLowerCase (L'Ω'), L'ω');
475+
EXPECT_EQ (CharacterFunctions::toLowerCase (U'Α'), U'α');
476+
EXPECT_EQ (CharacterFunctions::toLowerCase (U'Ω'), U'ω');
477477

478478
// Cyrillic
479-
EXPECT_EQ (CharacterFunctions::toLowerCase (L'А'), L'а');
480-
EXPECT_EQ (CharacterFunctions::toLowerCase (L'Я'), L'я');
479+
EXPECT_EQ (CharacterFunctions::toLowerCase (U'А'), U'а');
480+
EXPECT_EQ (CharacterFunctions::toLowerCase (U'Я'), U'я');
481481

482482
// Special case: capital I to dotted i
483-
EXPECT_EQ (CharacterFunctions::toLowerCase (L'İ'), L'i');
483+
EXPECT_EQ (CharacterFunctions::toLowerCase (U'İ'), U'i');
484484
}
485485

486486
TEST (CharacterFunctionsGeneralTests, IsUpperCase)
@@ -494,15 +494,15 @@ TEST (CharacterFunctionsGeneralTests, IsUpperCase)
494494
EXPECT_FALSE (CharacterFunctions::isUpperCase ('!'));
495495

496496
// Extended characters
497-
EXPECT_TRUE (CharacterFunctions::isUpperCase (L'À'));
498-
EXPECT_TRUE (CharacterFunctions::isUpperCase (L'Ñ'));
499-
EXPECT_TRUE (CharacterFunctions::isUpperCase (L'Ω'));
500-
EXPECT_TRUE (CharacterFunctions::isUpperCase (L'Я'));
501-
502-
EXPECT_FALSE (CharacterFunctions::isUpperCase (L'à'));
503-
EXPECT_FALSE (CharacterFunctions::isUpperCase (L'ñ'));
504-
EXPECT_FALSE (CharacterFunctions::isUpperCase (L'ω'));
505-
EXPECT_FALSE (CharacterFunctions::isUpperCase (L'я'));
497+
EXPECT_TRUE (CharacterFunctions::isUpperCase (U'À'));
498+
EXPECT_TRUE (CharacterFunctions::isUpperCase (U'Ñ'));
499+
EXPECT_TRUE (CharacterFunctions::isUpperCase (U'Ω'));
500+
EXPECT_TRUE (CharacterFunctions::isUpperCase (U'Я'));
501+
502+
EXPECT_FALSE (CharacterFunctions::isUpperCase (U'à'));
503+
EXPECT_FALSE (CharacterFunctions::isUpperCase (U'ñ'));
504+
EXPECT_FALSE (CharacterFunctions::isUpperCase (U'ω'));
505+
EXPECT_FALSE (CharacterFunctions::isUpperCase (U'я'));
506506
}
507507

508508
TEST (CharacterFunctionsGeneralTests, IsLowerCase)
@@ -516,15 +516,15 @@ TEST (CharacterFunctionsGeneralTests, IsLowerCase)
516516
EXPECT_FALSE (CharacterFunctions::isLowerCase ('!'));
517517

518518
// Extended characters
519-
EXPECT_TRUE (CharacterFunctions::isLowerCase (L'à'));
520-
EXPECT_TRUE (CharacterFunctions::isLowerCase (L'ñ'));
521-
EXPECT_TRUE (CharacterFunctions::isLowerCase (L'ω'));
522-
EXPECT_TRUE (CharacterFunctions::isLowerCase (L'я'));
523-
524-
EXPECT_FALSE (CharacterFunctions::isLowerCase (L'À'));
525-
EXPECT_FALSE (CharacterFunctions::isLowerCase (L'Ñ'));
526-
EXPECT_FALSE (CharacterFunctions::isLowerCase (L'Ω'));
527-
EXPECT_FALSE (CharacterFunctions::isLowerCase (L'Я'));
519+
EXPECT_TRUE (CharacterFunctions::isLowerCase (U'à'));
520+
EXPECT_TRUE (CharacterFunctions::isLowerCase (U'ñ'));
521+
EXPECT_TRUE (CharacterFunctions::isLowerCase (U'ω'));
522+
EXPECT_TRUE (CharacterFunctions::isLowerCase (U'я'));
523+
524+
EXPECT_FALSE (CharacterFunctions::isLowerCase (U'À'));
525+
EXPECT_FALSE (CharacterFunctions::isLowerCase (U'Ñ'));
526+
EXPECT_FALSE (CharacterFunctions::isLowerCase (U'Ω'));
527+
EXPECT_FALSE (CharacterFunctions::isLowerCase (U'Я'));
528528
}
529529

530530
TEST (CharacterFunctionsGeneralTests, IsWhitespace)
@@ -541,17 +541,17 @@ TEST (CharacterFunctionsGeneralTests, IsWhitespace)
541541
EXPECT_FALSE (CharacterFunctions::isWhitespace ('!'));
542542

543543
// yup_wchar version
544-
EXPECT_TRUE (CharacterFunctions::isWhitespace (yup_wchar (L' ')));
545-
EXPECT_TRUE (CharacterFunctions::isWhitespace (yup_wchar (L'\t')));
546-
EXPECT_TRUE (CharacterFunctions::isWhitespace (yup_wchar (L'\n')));
547-
EXPECT_TRUE (CharacterFunctions::isWhitespace (yup_wchar (L'\r')));
548-
EXPECT_TRUE (CharacterFunctions::isWhitespace (yup_wchar (L'\v')));
549-
EXPECT_TRUE (CharacterFunctions::isWhitespace (yup_wchar (L'\f')));
550-
//EXPECT_TRUE (CharacterFunctions::isWhitespace (yup_wchar (L'\u00A0'))); // Non-breaking space
551-
//EXPECT_TRUE (CharacterFunctions::isWhitespace (yup_wchar (L'\u2000'))); // En quad
552-
//EXPECT_TRUE (CharacterFunctions::isWhitespace (yup_wchar (L'\u2001'))); // Em quad
553-
EXPECT_FALSE (CharacterFunctions::isWhitespace (yup_wchar (L'a')));
554-
EXPECT_FALSE (CharacterFunctions::isWhitespace (yup_wchar (L'0')));
544+
EXPECT_TRUE (CharacterFunctions::isWhitespace (yup_wchar (U' ')));
545+
EXPECT_TRUE (CharacterFunctions::isWhitespace (yup_wchar (U'\t')));
546+
EXPECT_TRUE (CharacterFunctions::isWhitespace (yup_wchar (U'\n')));
547+
EXPECT_TRUE (CharacterFunctions::isWhitespace (yup_wchar (U'\r')));
548+
EXPECT_TRUE (CharacterFunctions::isWhitespace (yup_wchar (U'\v')));
549+
EXPECT_TRUE (CharacterFunctions::isWhitespace (yup_wchar (U'\f')));
550+
//EXPECT_TRUE (CharacterFunctions::isWhitespace (yup_wchar (U'\u00A0'))); // Non-breaking space
551+
//EXPECT_TRUE (CharacterFunctions::isWhitespace (yup_wchar (U'\u2000'))); // En quad
552+
//EXPECT_TRUE (CharacterFunctions::isWhitespace (yup_wchar (U'\u2001'))); // Em quad
553+
EXPECT_FALSE (CharacterFunctions::isWhitespace (yup_wchar (U'a')));
554+
EXPECT_FALSE (CharacterFunctions::isWhitespace (yup_wchar (U'0')));
555555
}
556556

557557
TEST (CharacterFunctionsGeneralTests, IsDigit)
@@ -566,12 +566,12 @@ TEST (CharacterFunctionsGeneralTests, IsDigit)
566566
EXPECT_FALSE (CharacterFunctions::isDigit ('!'));
567567

568568
// yup_wchar version
569-
for (auto c = yup_wchar (L'0'); c <= yup_wchar (L'9'); ++c)
569+
for (auto c = yup_wchar (U'0'); c <= yup_wchar (U'9'); ++c)
570570
EXPECT_TRUE (CharacterFunctions::isDigit (c));
571571

572-
EXPECT_FALSE (CharacterFunctions::isDigit (yup_wchar (L'a')));
573-
EXPECT_FALSE (CharacterFunctions::isDigit (yup_wchar (L'A')));
574-
EXPECT_FALSE (CharacterFunctions::isDigit (yup_wchar (L' ')));
572+
EXPECT_FALSE (CharacterFunctions::isDigit (yup_wchar (U'a')));
573+
EXPECT_FALSE (CharacterFunctions::isDigit (yup_wchar (U'A')));
574+
EXPECT_FALSE (CharacterFunctions::isDigit (yup_wchar (U' ')));
575575

576576
// Unicode digits from other scripts (should return true if iswdigit supports them)
577577
// Note: The behavior may vary depending on the locale and platform
@@ -592,20 +592,20 @@ TEST (CharacterFunctionsGeneralTests, IsLetter)
592592
EXPECT_FALSE (CharacterFunctions::isLetter ('!'));
593593

594594
// yup_wchar version
595-
for (auto c = yup_wchar (L'a'); c <= yup_wchar (L'z'); ++c)
595+
for (auto c = yup_wchar (U'a'); c <= yup_wchar (U'z'); ++c)
596596
EXPECT_TRUE (CharacterFunctions::isLetter (c));
597597

598-
for (auto c = yup_wchar (L'A'); c <= yup_wchar (L'Z'); ++c)
598+
for (auto c = yup_wchar (U'A'); c <= yup_wchar (U'Z'); ++c)
599599
EXPECT_TRUE (CharacterFunctions::isLetter (c));
600600

601601
// Extended characters
602-
//EXPECT_TRUE (CharacterFunctions::isLetter (yup_wchar (L'á')));
603-
//EXPECT_TRUE (CharacterFunctions::isLetter (yup_wchar (L'Ñ')));
604-
//EXPECT_TRUE (CharacterFunctions::isLetter (yup_wchar (L'ω')));
605-
//EXPECT_TRUE (CharacterFunctions::isLetter (yup_wchar (L'Я')));
602+
//EXPECT_TRUE (CharacterFunctions::isLetter (yup_wchar (U'á')));
603+
//EXPECT_TRUE (CharacterFunctions::isLetter (yup_wchar (U'Ñ')));
604+
//EXPECT_TRUE (CharacterFunctions::isLetter (yup_wchar (U'ω')));
605+
//EXPECT_TRUE (CharacterFunctions::isLetter (yup_wchar (U'Я')));
606606

607-
EXPECT_FALSE (CharacterFunctions::isLetter (yup_wchar (L'0')));
608-
EXPECT_FALSE (CharacterFunctions::isLetter (yup_wchar (L' ')));
607+
EXPECT_FALSE (CharacterFunctions::isLetter (yup_wchar (U'0')));
608+
EXPECT_FALSE (CharacterFunctions::isLetter (yup_wchar (U' ')));
609609
}
610610

611611
TEST (CharacterFunctionsGeneralTests, IsLetterOrDigit)
@@ -625,21 +625,21 @@ TEST (CharacterFunctionsGeneralTests, IsLetterOrDigit)
625625
EXPECT_FALSE (CharacterFunctions::isLetterOrDigit ('@'));
626626

627627
// yup_wchar version
628-
for (auto c = yup_wchar (L'a'); c <= yup_wchar (L'z'); ++c)
628+
for (auto c = yup_wchar (U'a'); c <= yup_wchar (U'z'); ++c)
629629
EXPECT_TRUE (CharacterFunctions::isLetterOrDigit (c));
630630

631-
for (auto c = yup_wchar (L'A'); c <= yup_wchar (L'Z'); ++c)
631+
for (auto c = yup_wchar (U'A'); c <= yup_wchar (U'Z'); ++c)
632632
EXPECT_TRUE (CharacterFunctions::isLetterOrDigit (c));
633633

634-
for (auto c = yup_wchar (L'0'); c <= yup_wchar (L'9'); ++c)
634+
for (auto c = yup_wchar (U'0'); c <= yup_wchar (U'9'); ++c)
635635
EXPECT_TRUE (CharacterFunctions::isLetterOrDigit (c));
636636

637637
// Extended characters
638-
//EXPECT_TRUE (CharacterFunctions::isLetterOrDigit (yup_wchar (L'á')));
639-
//EXPECT_TRUE (CharacterFunctions::isLetterOrDigit (yup_wchar (L'Ω')));
638+
//EXPECT_TRUE (CharacterFunctions::isLetterOrDigit (yup_wchar (U'á')));
639+
//EXPECT_TRUE (CharacterFunctions::isLetterOrDigit (yup_wchar (U'Ω')));
640640

641-
EXPECT_FALSE (CharacterFunctions::isLetterOrDigit (yup_wchar (L' ')));
642-
EXPECT_FALSE (CharacterFunctions::isLetterOrDigit (yup_wchar (L'!')));
641+
EXPECT_FALSE (CharacterFunctions::isLetterOrDigit (yup_wchar (U' ')));
642+
EXPECT_FALSE (CharacterFunctions::isLetterOrDigit (yup_wchar (U'!')));
643643
}
644644

645645
TEST (CharacterFunctionsGeneralTests, IsPrintable)
@@ -655,16 +655,16 @@ TEST (CharacterFunctionsGeneralTests, IsPrintable)
655655
//EXPECT_FALSE (CharacterFunctions::isPrintable (0x7F)); // DEL
656656

657657
// yup_wchar version
658-
for (auto c = yup_wchar (L' '); c <= yup_wchar (L'~'); ++c)
658+
for (auto c = yup_wchar (U' '); c <= yup_wchar (U'~'); ++c)
659659
EXPECT_TRUE (CharacterFunctions::isPrintable (c));
660660

661-
//EXPECT_TRUE (CharacterFunctions::isPrintable (yup_wchar (L'á')));
662-
//EXPECT_TRUE (CharacterFunctions::isPrintable (yup_wchar (L'€')));
663-
//EXPECT_TRUE (CharacterFunctions::isPrintable (yup_wchar (L'♪')));
661+
//EXPECT_TRUE (CharacterFunctions::isPrintable (yup_wchar (U'á')));
662+
//EXPECT_TRUE (CharacterFunctions::isPrintable (yup_wchar (U'€')));
663+
//EXPECT_TRUE (CharacterFunctions::isPrintable (yup_wchar (U'♪')));
664664

665-
EXPECT_FALSE (CharacterFunctions::isPrintable (yup_wchar (L'\0')));
666-
EXPECT_FALSE (CharacterFunctions::isPrintable (yup_wchar (L'\n')));
667-
EXPECT_FALSE (CharacterFunctions::isPrintable (yup_wchar (L'\t')));
665+
EXPECT_FALSE (CharacterFunctions::isPrintable (yup_wchar (U'\0')));
666+
EXPECT_FALSE (CharacterFunctions::isPrintable (yup_wchar (U'\n')));
667+
EXPECT_FALSE (CharacterFunctions::isPrintable (yup_wchar (U'\t')));
668668
}
669669

670670
TEST (CharacterFunctionsGeneralTests, GetHexDigitValue)
@@ -689,11 +689,11 @@ TEST (CharacterFunctionsGeneralTests, GetHexDigitValue)
689689
EXPECT_EQ (CharacterFunctions::getHexDigitValue (' '), -1);
690690

691691
// Wide characters
692-
EXPECT_EQ (CharacterFunctions::getHexDigitValue (L'0'), 0);
693-
EXPECT_EQ (CharacterFunctions::getHexDigitValue (L'9'), 9);
694-
EXPECT_EQ (CharacterFunctions::getHexDigitValue (L'a'), 10);
695-
EXPECT_EQ (CharacterFunctions::getHexDigitValue (L'F'), 15);
696-
EXPECT_EQ (CharacterFunctions::getHexDigitValue (L''), -1);
692+
EXPECT_EQ (CharacterFunctions::getHexDigitValue (U'0'), 0);
693+
EXPECT_EQ (CharacterFunctions::getHexDigitValue (U'9'), 9);
694+
EXPECT_EQ (CharacterFunctions::getHexDigitValue (U'a'), 10);
695+
EXPECT_EQ (CharacterFunctions::getHexDigitValue (U'F'), 15);
696+
EXPECT_EQ (CharacterFunctions::getHexDigitValue (U''), -1);
697697
}
698698

699699
TEST (CharacterFunctionsGeneralTests, GetUnicodeCharFromWindows1252Codepage)
@@ -748,23 +748,23 @@ TEST (CharacterFunctionsGeneralTests, GetUnicodeCharFromWindows1252Codepage)
748748
TEST (CharacterFunctionsGeneralTests, CaseConversionConsistency)
749749
{
750750
// Test that converting to upper and then to lower returns the original for lowercase letters
751-
for (wchar_t c = L'a'; c <= L'z'; ++c)
751+
for (auto c = yup_wchar (U'a'); c <= yup_wchar (U'z'); ++c)
752752
{
753753
auto upper = CharacterFunctions::toUpperCase (c);
754754
auto lower = CharacterFunctions::toLowerCase (upper);
755755
EXPECT_EQ (lower, c);
756756
}
757757

758758
// Test that converting to lower and then to upper returns the original for uppercase letters
759-
for (wchar_t c = L'A'; c <= L'Z'; ++c)
759+
for (auto c = yup_wchar (U'A'); c <= yup_wchar (U'Z'); ++c)
760760
{
761761
auto lower = CharacterFunctions::toLowerCase (c);
762762
auto upper = CharacterFunctions::toUpperCase (lower);
763763
EXPECT_EQ (upper, c);
764764
}
765765

766766
// Test some extended characters
767-
const wchar_t testChars[] = { L'à', L'é', L'ñ', L'α', L'ω', L'а', L'я' };
767+
const yup_wchar testChars[] = { U'à', U'é', U'ñ', U'α', U'ω', U'а', U'я' };
768768
for (auto c : testChars)
769769
{
770770
auto upper = CharacterFunctions::toUpperCase (c);

0 commit comments

Comments
 (0)