Browse Source

* test only a limited grid of surrogate pairs to avoid that tests run longer
than all other tests together when testing with -j

git-svn-id: branches/tg74/avx512@42646 -

florian 6 years ago
parent
commit
bce70a5105

+ 10 - 6
tests/test/units/character/tissurrogatepair.pp

@@ -17,6 +17,10 @@ uses
 {$ifndef FPC}
   type UnicodeChar = WideChar;   
 {$endif}
+
+const
+  { test only a spare grid, else the test runs too long (testing all combinations means dist=1) }
+  dist = 8;
     
 procedure DoError(ACode : Integer; ACodePoint1, ACodePoint2 : Integer); overload;
 begin
@@ -40,12 +44,12 @@ begin
   end;
 
   Inc(e);
-  for i := Low(Word) to High(Word) do begin
-    if (i < HIGH_SURROGATE_BEGIN) or (i > HIGH_SURROGATE_END) then begin
-      for j := Low(Word) to High(Word) do begin
-        if (j < LOW_SURROGATE_BEGIN) or (j > LOW_SURROGATE_END) then begin
-          if TCharacter.IsSurrogatePair(UnicodeChar(i),UnicodeChar(j)) then
-            DoError(e,i,j);
+  for i := Low(Word) to High(Word) div dist do begin
+    if (i*dist < HIGH_SURROGATE_BEGIN) or (i*dist > HIGH_SURROGATE_END) then begin
+      for j := Low(Word) to High(Word) div dist do begin
+        if (j*dist < LOW_SURROGATE_BEGIN) or (j*dist > LOW_SURROGATE_END) then begin
+          if TCharacter.IsSurrogatePair(UnicodeChar(i*dist),UnicodeChar(j*dist)) then
+            DoError(e,i*dist,j*dist);
         end;
       end;
     end;

+ 11 - 7
tests/test/units/character/tissurrogatepair2.pp

@@ -17,6 +17,10 @@ uses
 {$ifndef FPC}
   type UnicodeChar = WideChar;   
 {$endif}
+
+const
+  { test only a spare grid, else the test runs too long (testing all combinations means dist=1) }
+  dist = 8;
     
 procedure DoError(ACode : Integer; ACodePoint1, ACodePoint2 : Integer); overload;
 begin
@@ -44,14 +48,14 @@ begin
   end;
 
   Inc(e);
-  for i := Low(Word) to High(Word) do begin
-    if (i < HIGH_SURROGATE_BEGIN) or (i > HIGH_SURROGATE_END) then begin
-      for j := Low(Word) to High(Word) do begin
-        if (j < LOW_SURROGATE_BEGIN) or (j > LOW_SURROGATE_END) then begin
-          s[5] := UnicodeChar(i);
-          s[6] := UnicodeChar(j);
+  for i := Low(Word) to High(Word) div dist do begin
+    if (i*dist < HIGH_SURROGATE_BEGIN) or (i*dist > HIGH_SURROGATE_END) then begin
+      for j := Low(Word) to High(Word) div dist do begin
+        if (j*dist < LOW_SURROGATE_BEGIN) or (j*dist > LOW_SURROGATE_END) then begin
+          s[5] := UnicodeChar(i*dist);
+          s[6] := UnicodeChar(j*dist);
           if TCharacter.IsSurrogatePair(s,5) then
-            DoError(e,i,j);
+            DoError(e,i*dist,j*dist);
         end;
       end;
     end;