From 0846456ce47fe90a0140100e58ccfe0081059774 Mon Sep 17 00:00:00 2001 From: pierre Date: Sat, 15 Dec 2018 21:06:01 +0000 Subject: [PATCH] * Skip all surrogate values in for loops from low(word) to high(word) git-svn-id: trunk@40560 - --- tests/test/units/character/tgetnumericvalue.pp | 4 +++- tests/test/units/character/tgetnumericvalue2.pp | 4 +++- tests/test/units/character/tgetnumericvalue3.pp | 2 +- tests/test/units/character/tgetunicodecategoriesurro.pp | 2 +- tests/test/units/character/tiscontrol.pp | 4 +++- tests/test/units/character/tiscontrol2.pp | 4 +++- tests/test/units/character/tiscontrol3.pp | 2 +- tests/test/units/character/tisdigit.pp | 4 +++- tests/test/units/character/tisdigit2.pp | 4 +++- tests/test/units/character/tisdigit3.pp | 2 +- tests/test/units/character/tishighsurrogate.pp | 7 +------ tests/test/units/character/tisletter.pp | 6 +++++- tests/test/units/character/tisletterordigit.pp | 6 +++++- tests/test/units/character/tislowsurrogate.pp | 7 +------ tests/test/units/character/tisnumber.pp | 4 +++- tests/test/units/character/tisnumber2.pp | 4 +++- tests/test/units/character/tispunctuation.pp | 4 +++- tests/test/units/character/tisseparator.pp | 6 +++++- tests/test/units/character/tissurrogate.pp | 2 +- tests/test/units/character/tissurrogatepair.pp | 9 +-------- tests/test/units/character/tissurrogatepair2.pp | 9 +-------- tests/test/units/character/tissymbol.pp | 6 +++++- tests/test/units/character/tisupper.pp | 6 +++++- tests/test/units/character/tiswhitespace.pp | 4 +++- tests/test/units/character/tlowercase.pp | 6 +++++- tests/test/units/character/tlowercase2.pp | 6 +++++- tests/test/units/character/ttolower.pp | 4 +++- tests/test/units/character/ttolower2.pp | 2 +- tests/test/units/character/ttolower3.pp | 2 +- tests/test/units/character/ttoupper.pp | 4 +++- tests/test/units/character/ttoupper2.pp | 2 +- tests/test/units/character/ttoupper3.pp | 2 +- 32 files changed, 84 insertions(+), 56 deletions(-) diff --git a/tests/test/units/character/tgetnumericvalue.pp b/tests/test/units/character/tgetnumericvalue.pp index 552c8ffd59..d334ed8eb8 100644 --- a/tests/test/units/character/tgetnumericvalue.pp +++ b/tests/test/units/character/tgetnumericvalue.pp @@ -12,7 +12,7 @@ program tgetnumericvalue; uses SysUtils, - character; + unicodedata,character; {$ifndef FPC} type UnicodeChar = WideChar; @@ -44,6 +44,8 @@ begin e := 1; k := 0; for i := Low(Word) to High(Word) do begin + { Skip all surrogate values } + if (i>=HIGH_SURROGATE_BEGIN) and (i<=LOW_SURROGATE_END) then continue; uc := UnicodeChar(i); if (TCharacter.GetUnicodeCategory(uc) in [ TUnicodeCategory.ucDecimalNumber, diff --git a/tests/test/units/character/tgetnumericvalue2.pp b/tests/test/units/character/tgetnumericvalue2.pp index 81d0b4c99c..c91d4ff54d 100644 --- a/tests/test/units/character/tgetnumericvalue2.pp +++ b/tests/test/units/character/tgetnumericvalue2.pp @@ -12,7 +12,7 @@ program tgetnumericvalue2; uses SysUtils, - character; + unicodedata,character; {$ifndef FPC} type UnicodeChar = WideChar; @@ -54,6 +54,8 @@ begin e := 1; k := 0; for i := Low(Word) to High(Word) do begin + { Skip all surrogate values } + if (i>=HIGH_SURROGATE_BEGIN) and (i<=LOW_SURROGATE_END) then continue; uc := strPrefix + UnicodeChar(i) + strPrefix; if (TCharacter.GetUnicodeCategory(uc,locCharPos) in [ TUnicodeCategory.ucDecimalNumber, diff --git a/tests/test/units/character/tgetnumericvalue3.pp b/tests/test/units/character/tgetnumericvalue3.pp index ebd7aa923a..91597f9479 100644 --- a/tests/test/units/character/tgetnumericvalue3.pp +++ b/tests/test/units/character/tgetnumericvalue3.pp @@ -12,7 +12,7 @@ program tgetnumericvalue3; uses SysUtils, - character; + unicodedata,character; {$ifndef FPC} type UnicodeChar = WideChar; diff --git a/tests/test/units/character/tgetunicodecategoriesurro.pp b/tests/test/units/character/tgetunicodecategoriesurro.pp index d846e89bd5..4ac6f663ba 100644 --- a/tests/test/units/character/tgetunicodecategoriesurro.pp +++ b/tests/test/units/character/tgetunicodecategoriesurro.pp @@ -12,7 +12,7 @@ program tgetunicodecategoriesurro; uses SysUtils, - character; + unicodedata,character; {$ifndef FPC} type UnicodeChar = WideChar; diff --git a/tests/test/units/character/tiscontrol.pp b/tests/test/units/character/tiscontrol.pp index 156a27f55b..01ff491c8d 100644 --- a/tests/test/units/character/tiscontrol.pp +++ b/tests/test/units/character/tiscontrol.pp @@ -12,7 +12,7 @@ program tiscontrol; uses SysUtils, - character; + unicodedata,character; {$ifndef FPC} type UnicodeChar = WideChar; @@ -56,6 +56,8 @@ begin Inc(e); for i := Low(Word) to High(Word) do begin + { Skip all surrogate values } + if (i>=HIGH_SURROGATE_BEGIN) and (i<=LOW_SURROGATE_END) then continue; uc := UnicodeChar(i); if (TCharacter.GetUnicodeCategory(uc) = TUnicodeCategory.ucControl) then begin if not TCharacter.IsControl(uc) then diff --git a/tests/test/units/character/tiscontrol2.pp b/tests/test/units/character/tiscontrol2.pp index c62b2c5104..bcf0a9a2c7 100644 --- a/tests/test/units/character/tiscontrol2.pp +++ b/tests/test/units/character/tiscontrol2.pp @@ -12,7 +12,7 @@ program tiscontrol2; uses SysUtils, - character; + unicodedata,character; {$ifndef FPC} type UnicodeChar = WideChar; @@ -59,6 +59,8 @@ begin Inc(e); for i := Low(Word) to High(Word) do begin + { Skip all surrogate values } + if (i>=HIGH_SURROGATE_BEGIN) and (i<=LOW_SURROGATE_END) then continue; uc := strPrefix + UnicodeChar(i) + strPrefix; if (TCharacter.GetUnicodeCategory(uc,locCharPos) = TUnicodeCategory.ucControl) then begin if not TCharacter.IsControl(uc,locCharPos) then diff --git a/tests/test/units/character/tiscontrol3.pp b/tests/test/units/character/tiscontrol3.pp index 4158be599f..e6b93f0f5a 100644 --- a/tests/test/units/character/tiscontrol3.pp +++ b/tests/test/units/character/tiscontrol3.pp @@ -12,7 +12,7 @@ program tisdigit3; uses SysUtils, - character; + unicodedata,character; {$ifndef FPC} type UnicodeChar = WideChar; diff --git a/tests/test/units/character/tisdigit.pp b/tests/test/units/character/tisdigit.pp index ec65d6b7dd..1c7b458316 100644 --- a/tests/test/units/character/tisdigit.pp +++ b/tests/test/units/character/tisdigit.pp @@ -12,7 +12,7 @@ program tisdigit; uses SysUtils, - character; + unicodedata,character; {$ifndef FPC} type UnicodeChar = WideChar; @@ -49,6 +49,8 @@ begin Inc(e); for i := Low(Word) to High(Word) do begin + { Skip all surrogate values } + if (i>=HIGH_SURROGATE_BEGIN) and (i<=LOW_SURROGATE_END) then continue; uc := UnicodeChar(i); if (TCharacter.GetUnicodeCategory(uc) = TUnicodeCategory.ucDecimalNumber) then begin if not TCharacter.IsDigit(uc) then diff --git a/tests/test/units/character/tisdigit2.pp b/tests/test/units/character/tisdigit2.pp index e825d7606f..037dc6e647 100644 --- a/tests/test/units/character/tisdigit2.pp +++ b/tests/test/units/character/tisdigit2.pp @@ -12,7 +12,7 @@ program tisdigit2; uses SysUtils, - character; + unicodedata,character; {$ifndef FPC} type UnicodeChar = WideChar; @@ -52,6 +52,8 @@ begin Inc(e); for i := Low(Word) to High(Word) do begin + { Skip all surrogate values } + if (i>=HIGH_SURROGATE_BEGIN) and (i<=LOW_SURROGATE_END) then continue; uc := strPrefix + UnicodeChar(i) + strPrefix; if (TCharacter.GetUnicodeCategory(uc,locCharPos) = TUnicodeCategory.ucDecimalNumber) then begin if not TCharacter.IsDigit(uc,locCharPos) then diff --git a/tests/test/units/character/tisdigit3.pp b/tests/test/units/character/tisdigit3.pp index ebd7aa923a..91597f9479 100644 --- a/tests/test/units/character/tisdigit3.pp +++ b/tests/test/units/character/tisdigit3.pp @@ -12,7 +12,7 @@ program tgetnumericvalue3; uses SysUtils, - character; + unicodedata,character; {$ifndef FPC} type UnicodeChar = WideChar; diff --git a/tests/test/units/character/tishighsurrogate.pp b/tests/test/units/character/tishighsurrogate.pp index 0781f4527e..b3d154d78c 100644 --- a/tests/test/units/character/tishighsurrogate.pp +++ b/tests/test/units/character/tishighsurrogate.pp @@ -12,7 +12,7 @@ program tishighsurrogate; uses SysUtils, - character; + unicodedata,character; {$ifndef FPC} type UnicodeChar = WideChar; @@ -36,11 +36,6 @@ begin Halt(Acode); end; -const - LOW_SURROGATE_BEGIN = Word($DC00); - LOW_SURROGATE_END = Word($DFFF); - HIGH_SURROGATE_BEGIN = Word($D800); - HIGH_SURROGATE_END = Word($DBFF); var e, i , k: Integer; uc : UnicodeChar; diff --git a/tests/test/units/character/tisletter.pp b/tests/test/units/character/tisletter.pp index 083c8bec45..d7823bd4fc 100644 --- a/tests/test/units/character/tisletter.pp +++ b/tests/test/units/character/tisletter.pp @@ -12,7 +12,7 @@ program tisletter; uses SysUtils, - character; + unicodedata,character; {$ifndef FPC} type UnicodeChar = WideChar; @@ -56,6 +56,8 @@ begin Inc(e); for i := Low(Word) to High(Word) do begin + { Skip all surrogate values } + if (i>=HIGH_SURROGATE_BEGIN) and (i<=LOW_SURROGATE_END) then continue; uc := UnicodeChar(i); if (TCharacter.GetUnicodeCategory(uc) in [ TUnicodeCategory.ucUppercaseLetter, TUnicodeCategory.ucLowercaseLetter, @@ -78,6 +80,8 @@ begin Inc(e); for i := Low(Word) to High(Word) do begin + { Skip all surrogate values } + if (i>=HIGH_SURROGATE_BEGIN) and (i<=LOW_SURROGATE_END) then continue; uc := UnicodeChar(i); if not (TCharacter.GetUnicodeCategory(uc) in [ TUnicodeCategory.ucUppercaseLetter, TUnicodeCategory.ucLowercaseLetter, diff --git a/tests/test/units/character/tisletterordigit.pp b/tests/test/units/character/tisletterordigit.pp index aa15f28137..80bccae632 100644 --- a/tests/test/units/character/tisletterordigit.pp +++ b/tests/test/units/character/tisletterordigit.pp @@ -12,7 +12,7 @@ program tisletterordigit; uses SysUtils, - character; + unicodedata,character; {$ifndef FPC} type UnicodeChar = WideChar; @@ -63,6 +63,8 @@ begin Inc(e); for i := Low(Word) to High(Word) do begin + { Skip all surrogate values } + if (i>=HIGH_SURROGATE_BEGIN) and (i<=LOW_SURROGATE_END) then continue; uc := UnicodeChar(i); if (TCharacter.GetUnicodeCategory(uc) in [ TUnicodeCategory.ucUppercaseLetter, TUnicodeCategory.ucLowercaseLetter, @@ -79,6 +81,8 @@ begin Inc(e); for i := Low(Word) to High(Word) do begin + { Skip all surrogate values } + if (i>=HIGH_SURROGATE_BEGIN) and (i<=LOW_SURROGATE_END) then continue; uc := UnicodeChar(i); if not (TCharacter.GetUnicodeCategory(uc) in [ TUnicodeCategory.ucUppercaseLetter, TUnicodeCategory.ucLowercaseLetter, diff --git a/tests/test/units/character/tislowsurrogate.pp b/tests/test/units/character/tislowsurrogate.pp index 08400d8a00..e0d47014ed 100644 --- a/tests/test/units/character/tislowsurrogate.pp +++ b/tests/test/units/character/tislowsurrogate.pp @@ -12,7 +12,7 @@ program tislowsurrogate; uses SysUtils, - character; + unicodedata,character; {$ifndef FPC} type UnicodeChar = WideChar; @@ -36,11 +36,6 @@ begin Halt(Acode); end; -const - LOW_SURROGATE_BEGIN = Word($DC00); - LOW_SURROGATE_END = Word($DFFF); - HIGH_SURROGATE_BEGIN = Word($D800); - HIGH_SURROGATE_END = Word($DBFF); var e, i , k: Integer; uc : UnicodeChar; diff --git a/tests/test/units/character/tisnumber.pp b/tests/test/units/character/tisnumber.pp index 367b61df87..607b769e24 100644 --- a/tests/test/units/character/tisnumber.pp +++ b/tests/test/units/character/tisnumber.pp @@ -12,7 +12,7 @@ program tisnumber; uses SysUtils, - character; + unicodedata, character; {$ifndef FPC} type UnicodeChar = WideChar; @@ -44,6 +44,8 @@ begin e := 1; k := 0; for i := Low(Word) to High(Word) do begin + { Skip all surrogate values } + if (i>=HIGH_SURROGATE_BEGIN) and (i<=LOW_SURROGATE_END) then continue; uc := UnicodeChar(i); if TCharacter.IsNumber(uc) then begin WriteLn('CodePoint = ',IntToHex(Ord(uc),4), ' ; IsNumber = ',TCharacter.IsNumber(uc)); diff --git a/tests/test/units/character/tisnumber2.pp b/tests/test/units/character/tisnumber2.pp index b1b0ee9ed0..9bb1c7812d 100644 --- a/tests/test/units/character/tisnumber2.pp +++ b/tests/test/units/character/tisnumber2.pp @@ -12,7 +12,7 @@ program tisnumber2; uses SysUtils, - character; + unicodedata,character; {$ifndef FPC} type UnicodeChar = WideChar; @@ -47,6 +47,8 @@ begin e := 1; k := 0; for i := Low(Word) to High(Word) do begin + { Skip all surrogate values } + if (i>=HIGH_SURROGATE_BEGIN) and (i<=LOW_SURROGATE_END) then continue; uc := strPrefix + UnicodeChar(i) + strPrefix; if TCharacter.IsNumber(uc,locCharPos) then begin WriteLn('CodePoint = ',IntToHex(Ord(uc[locCharPos]),4), ' ; IsNumber = ',TCharacter.IsNumber(uc,locCharPos)); diff --git a/tests/test/units/character/tispunctuation.pp b/tests/test/units/character/tispunctuation.pp index eb5ede83b3..eabb1d2501 100644 --- a/tests/test/units/character/tispunctuation.pp +++ b/tests/test/units/character/tispunctuation.pp @@ -12,7 +12,7 @@ program tispunctuation; uses SysUtils, - character; + unicodedata,character; {$ifndef FPC} type UnicodeChar = WideChar; @@ -80,6 +80,8 @@ begin Inc(e); for i := Low(Word) to High(Word) do begin + { Skip all surrogate values } + if (i>=HIGH_SURROGATE_BEGIN) and (i<=LOW_SURROGATE_END) then continue; uc := UnicodeChar(i); if (TCharacter.GetUnicodeCategory(uc) in [ TUnicodeCategory.ucConnectPunctuation, TUnicodeCategory.ucDashPunctuation, diff --git a/tests/test/units/character/tisseparator.pp b/tests/test/units/character/tisseparator.pp index 8e0b27c9ed..f5706c78d5 100644 --- a/tests/test/units/character/tisseparator.pp +++ b/tests/test/units/character/tisseparator.pp @@ -12,7 +12,7 @@ program tisseparator; uses SysUtils, - character; + unicodedata,character; {$ifndef FPC} type UnicodeChar = WideChar; @@ -60,6 +60,8 @@ begin Inc(e); for i := Low(Word) to High(Word) do begin + { Skip all surrogate values } + if (i>=HIGH_SURROGATE_BEGIN) and (i<=LOW_SURROGATE_END) then continue; uc := UnicodeChar(i); if (TCharacter.GetUnicodeCategory(uc) in [ TUnicodeCategory.ucSpaceSeparator, @@ -75,6 +77,8 @@ begin Inc(e); for i := Low(Word) to High(Word) do begin + { Skip all surrogate values } + if (i>=HIGH_SURROGATE_BEGIN) and (i<=LOW_SURROGATE_END) then continue; uc := UnicodeChar(i); if not (TCharacter.GetUnicodeCategory(uc) in [ TUnicodeCategory.ucSpaceSeparator, diff --git a/tests/test/units/character/tissurrogate.pp b/tests/test/units/character/tissurrogate.pp index f1d12eb92b..91f9e5cf90 100644 --- a/tests/test/units/character/tissurrogate.pp +++ b/tests/test/units/character/tissurrogate.pp @@ -12,7 +12,7 @@ program tissurrogate; uses SysUtils, - character; + unicodedata,character; {$ifndef FPC} type UnicodeChar = WideChar; diff --git a/tests/test/units/character/tissurrogatepair.pp b/tests/test/units/character/tissurrogatepair.pp index 618237f608..5491cf06ad 100644 --- a/tests/test/units/character/tissurrogatepair.pp +++ b/tests/test/units/character/tissurrogatepair.pp @@ -12,7 +12,7 @@ program tissurrogatepair; uses SysUtils, - character; + unicodedata,character; {$ifndef FPC} type UnicodeChar = WideChar; @@ -28,13 +28,6 @@ begin Halt(Acode); end; -const - LOW_SURROGATE_BEGIN = Word($DC00); - LOW_SURROGATE_END = Word($DFFF); - - HIGH_SURROGATE_BEGIN = Word($D800); - HIGH_SURROGATE_END = Word($DBFF); - var e, i , j: Integer; begin diff --git a/tests/test/units/character/tissurrogatepair2.pp b/tests/test/units/character/tissurrogatepair2.pp index 052ffc9dfd..39ee6e3cdc 100644 --- a/tests/test/units/character/tissurrogatepair2.pp +++ b/tests/test/units/character/tissurrogatepair2.pp @@ -12,7 +12,7 @@ program tissurrogatepair2; uses SysUtils, - character; + unicodedata,character; {$ifndef FPC} type UnicodeChar = WideChar; @@ -28,13 +28,6 @@ begin Halt(Acode); end; -const - LOW_SURROGATE_BEGIN = Word($DC00); - LOW_SURROGATE_END = Word($DFFF); - - HIGH_SURROGATE_BEGIN = Word($D800); - HIGH_SURROGATE_END = Word($DBFF); - var e, i , j: Integer; s : UnicodeString; diff --git a/tests/test/units/character/tissymbol.pp b/tests/test/units/character/tissymbol.pp index b1639fa071..f3da459ac8 100644 --- a/tests/test/units/character/tissymbol.pp +++ b/tests/test/units/character/tissymbol.pp @@ -12,7 +12,7 @@ program tissymbol; uses SysUtils, - character; + unicodedata,character; {$ifndef FPC} type UnicodeChar = WideChar; @@ -89,6 +89,8 @@ begin Inc(e); for i := Low(Word) to High(Word) do begin + { Skip all surrogate values } + if (i>=HIGH_SURROGATE_BEGIN) and (i<=LOW_SURROGATE_END) then continue; uc := UnicodeChar(i); if (TCharacter.GetUnicodeCategory(uc) in [ TUnicodeCategory.ucMathSymbol, @@ -105,6 +107,8 @@ begin Inc(e); for i := Low(Word) to High(Word) do begin + { Skip all surrogate values } + if (i>=HIGH_SURROGATE_BEGIN) and (i<=LOW_SURROGATE_END) then continue; uc := UnicodeChar(i); if not (TCharacter.GetUnicodeCategory(uc) in [ TUnicodeCategory.ucMathSymbol, diff --git a/tests/test/units/character/tisupper.pp b/tests/test/units/character/tisupper.pp index 7f3bf528fb..2a36bf4156 100644 --- a/tests/test/units/character/tisupper.pp +++ b/tests/test/units/character/tisupper.pp @@ -12,7 +12,7 @@ program tisupper; uses SysUtils, - character; + unicodedata,character; {$ifndef FPC} type UnicodeChar = WideChar; @@ -56,6 +56,8 @@ begin Inc(e); for i := Low(Word) to High(Word) do begin + { Skip all surrogate values } + if (i>=HIGH_SURROGATE_BEGIN) and (i<=LOW_SURROGATE_END) then continue; uc := UnicodeChar(i); if (TCharacter.GetUnicodeCategory(uc) = TUnicodeCategory.ucUppercaseLetter) then begin if not TCharacter.IsUpper(uc) then @@ -65,6 +67,8 @@ begin Inc(e); for i := Low(Word) to High(Word) do begin + { Skip all surrogate values } + if (i>=HIGH_SURROGATE_BEGIN) and (i<=LOW_SURROGATE_END) then continue; uc := UnicodeChar(i); if (TCharacter.GetUnicodeCategory(uc) <> TUnicodeCategory.ucUppercaseLetter) then begin if TCharacter.IsUpper(uc) then diff --git a/tests/test/units/character/tiswhitespace.pp b/tests/test/units/character/tiswhitespace.pp index 5b2dc4d94c..dc875bd87b 100644 --- a/tests/test/units/character/tiswhitespace.pp +++ b/tests/test/units/character/tiswhitespace.pp @@ -12,7 +12,7 @@ program tiswhitespace; uses SysUtils, - character; + unicodedata,character; {$ifndef FPC} type UnicodeChar = WideChar; @@ -86,6 +86,8 @@ begin Inc(e); for i := Low(Word) to High(Word) do begin + { Skip all surrogate values } + if (i>=HIGH_SURROGATE_BEGIN) and (i<=LOW_SURROGATE_END) then continue; uc := UnicodeChar(i); if (TCharacter.GetUnicodeCategory(uc) in [ TUnicodeCategory.ucSpaceSeparator, diff --git a/tests/test/units/character/tlowercase.pp b/tests/test/units/character/tlowercase.pp index 95f9d64f37..0fb98431df 100644 --- a/tests/test/units/character/tlowercase.pp +++ b/tests/test/units/character/tlowercase.pp @@ -12,7 +12,7 @@ program tlowercase; uses SysUtils, - character; + unicodedata,character; {$ifndef FPC} type UnicodeChar = WideChar; @@ -56,6 +56,8 @@ begin Inc(e); for i := Low(Word) to High(Word) do begin + { Skip all surrogate values } + if (i>=HIGH_SURROGATE_BEGIN) and (i<=LOW_SURROGATE_END) then continue; uc := UnicodeChar(i); if (TCharacter.GetUnicodeCategory(uc) = TUnicodeCategory.ucLowercaseLetter) then begin if not TCharacter.IsLower(uc) then @@ -65,6 +67,8 @@ begin Inc(e); for i := Low(Word) to High(Word) do begin + { Skip all surrogate values } + if (i>=HIGH_SURROGATE_BEGIN) and (i<=LOW_SURROGATE_END) then continue; uc := UnicodeChar(i); if (TCharacter.GetUnicodeCategory(uc) <> TUnicodeCategory.ucLowercaseLetter) then begin if TCharacter.IsLower(uc) then diff --git a/tests/test/units/character/tlowercase2.pp b/tests/test/units/character/tlowercase2.pp index c0cbc92e43..d5865137bc 100644 --- a/tests/test/units/character/tlowercase2.pp +++ b/tests/test/units/character/tlowercase2.pp @@ -12,7 +12,7 @@ program tlowercase2; uses SysUtils, - character; + unicodedata,character; {$ifndef FPC} type UnicodeChar = WideChar; @@ -65,6 +65,8 @@ begin Inc(e); for i := Low(Word) to High(Word) do begin + { Skip all surrogate values } + if (i>=HIGH_SURROGATE_BEGIN) and (i<=LOW_SURROGATE_END) then continue; uc := strPrefix + UnicodeChar(i) + strPrefix; if (TCharacter.GetUnicodeCategory(uc,locCharPos) = TUnicodeCategory.ucLowercaseLetter) then begin if not TCharacter.IsLower(uc,locCharPos) then @@ -74,6 +76,8 @@ begin Inc(e); for i := Low(Word) to High(Word) do begin + { Skip all surrogate values } + if (i>=HIGH_SURROGATE_BEGIN) and (i<=LOW_SURROGATE_END) then continue; uc := strPrefix + UnicodeChar(i) + strPrefix; if (TCharacter.GetUnicodeCategory(uc,locCharPos) <> TUnicodeCategory.ucLowercaseLetter) then begin if TCharacter.IsLower(uc,locCharPos) then diff --git a/tests/test/units/character/ttolower.pp b/tests/test/units/character/ttolower.pp index e1d099141b..c594fa56b9 100644 --- a/tests/test/units/character/ttolower.pp +++ b/tests/test/units/character/ttolower.pp @@ -12,7 +12,7 @@ program ttolower; uses SysUtils, - character; + unicodedata,character; {$ifndef FPC} type UnicodeChar = WideChar; @@ -65,6 +65,8 @@ begin Inc(e); for i := Low(Word) to High(Word) do begin + { Skip all surrogate values } + if (i>=HIGH_SURROGATE_BEGIN) and (i<=LOW_SURROGATE_END) then continue; uc := UnicodeChar(i); if (TCharacter.GetUnicodeCategory(uc) = TUnicodeCategory.ucLowercaseLetter) then begin if (TCharacter.ToLower(uc) <> uc) then diff --git a/tests/test/units/character/ttolower2.pp b/tests/test/units/character/ttolower2.pp index 219b552406..c83cf877af 100644 --- a/tests/test/units/character/ttolower2.pp +++ b/tests/test/units/character/ttolower2.pp @@ -12,7 +12,7 @@ program ttolower2; uses SysUtils, - character; + unicodedata,character; {$ifndef FPC} type UnicodeChar = WideChar; diff --git a/tests/test/units/character/ttolower3.pp b/tests/test/units/character/ttolower3.pp index a13affaa20..f5f6c8ea11 100644 --- a/tests/test/units/character/ttolower3.pp +++ b/tests/test/units/character/ttolower3.pp @@ -12,7 +12,7 @@ program ttolower3; uses SysUtils, - character; + unicodedata,character; {$ifndef FPC} type UnicodeChar = WideChar; diff --git a/tests/test/units/character/ttoupper.pp b/tests/test/units/character/ttoupper.pp index 83e45456df..f240141bb8 100644 --- a/tests/test/units/character/ttoupper.pp +++ b/tests/test/units/character/ttoupper.pp @@ -12,7 +12,7 @@ program ttoupper; uses SysUtils, - character; + unicodedata,character; {$ifndef FPC} type UnicodeChar = WideChar; @@ -65,6 +65,8 @@ begin Inc(e); for i := Low(Word) to High(Word) do begin + { Skip all surrogate values } + if (i>=HIGH_SURROGATE_BEGIN) and (i<=LOW_SURROGATE_END) then continue; uc := UnicodeChar(i); if (TCharacter.GetUnicodeCategory(uc) = TUnicodeCategory.ucUppercaseLetter) then begin if (TCharacter.ToUpper(uc) <> uc) then diff --git a/tests/test/units/character/ttoupper2.pp b/tests/test/units/character/ttoupper2.pp index 08175e57de..14453ebed5 100644 --- a/tests/test/units/character/ttoupper2.pp +++ b/tests/test/units/character/ttoupper2.pp @@ -12,7 +12,7 @@ program ttoupper2; uses SysUtils, - character; + unicodedata,character; {$ifndef FPC} type UnicodeChar = WideChar; diff --git a/tests/test/units/character/ttoupper3.pp b/tests/test/units/character/ttoupper3.pp index 1100fd395b..1e4eabc01f 100644 --- a/tests/test/units/character/ttoupper3.pp +++ b/tests/test/units/character/ttoupper3.pp @@ -12,7 +12,7 @@ program ttoupper3; uses SysUtils, - character; + unicodedata,character; {$ifndef FPC} type UnicodeChar = WideChar;