diff options
author | Andrii Doroshenko (Xrayez) <xrayez@gmail.com> | 2019-03-07 17:51:59 +0200 |
---|---|---|
committer | Andrii Doroshenko (Xrayez) <xrayez@gmail.com> | 2019-04-05 11:10:15 +0300 |
commit | 34e67374132a7b99054b445c35a2caeee7c46160 (patch) | |
tree | a27b80d0b5762d15cbd25f3daf55a6740f3a970f /main/tests | |
parent | b376273f1b30b1187731b318c0f6eb0447acd289 (diff) |
Reorder reverse caps characters table for string lower case conversion
The binary search algorithm used to lookup character codes in the table
relies that the data must be ordered. This fixes `to_lower()` string
method to convert upper case to lower case properly, so that the
algorithm doesn't terminate prematurely.
Co-authored-by: AndreevAndrei (avandrei) <avandrei@MacBookAAV.local>
Diffstat (limited to 'main/tests')
-rw-r--r-- | main/tests/test_string.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/main/tests/test_string.cpp b/main/tests/test_string.cpp index 3465fd783e..dcbb930d1b 100644 --- a/main/tests/test_string.cpp +++ b/main/tests/test_string.cpp @@ -1053,6 +1053,19 @@ bool test_33() { return empty.parse_utf8(NULL, -1) == true; } +bool test_34() { + OS::get_singleton()->print("\n\nTest 34: Cyrillic to_lower()\n"); + + String upper = L"АБВГДЕЁЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ"; + String lower = L"абвгдеёжзийклмнопрстуфхцчшщъыьэюя"; + + String test = upper.to_lower(); + + bool state = test == lower; + + return state; +} + typedef bool (*TestFunc)(void); TestFunc test_funcs[] = { @@ -1090,6 +1103,7 @@ TestFunc test_funcs[] = { test_31, test_32, test_33, + test_34, 0 }; |