Browse Source

* Use more common code pages 1251 and 1252 instead of old DOS code pages (not available on Android). There is Euro symbol character that has different code in 1251 and 1252 code pages. Use it for tests.

git-svn-id: branches/targetandroid@23389 -
yury 12 years ago
parent
commit
a5182d6487
3 changed files with 33 additions and 32 deletions
  1. 10 11
      tests/test/tcpstr1.pp
  2. 14 12
      tests/test/tcpstransistrcompare.pp
  3. 9 9
      tests/test/tcpstransistrcompareequal.pp

+ 10 - 11
tests/test/tcpstr1.pp

@@ -1,36 +1,35 @@
-{$CODEPAGE cp437}
-
 {$ifdef unix}
 uses
   cwstring;
 {$endif}
 
 type
-  tcpstr437 = type AnsiString(437);
-  tcpstr850 = type AnsiString(850);
+  tcpstr1 = type AnsiString(1252);
+  tcpstr2 = type AnsiString(1251);
 var
-  a1 : tcpstr437;
+  a1 : tcpstr1;
   a2 : utf8string;
-  a3 : tcpstr850;
+  a3 : tcpstr2;
   u1 : unicodestring;
 begin
-  a1:=#132;
+  a1:=' ';
+  a1[1]:=char($80); // Euro symbol in cp1252
   a2:=a1;
-  if ord(a2[1])<>195 then
+  if ord(a2[1])<>$E2 then
     halt(1);
-  if ord(a2[2])<>164 then
+  if ord(a2[2])<>$82 then
     halt(2);
 
   writeln('---');
 
   a3:=a1;
-  if ord(a3[1])<>132 then
+  if ord(a3[1])<>$88 then
     halt(3);
 
   writeln('---');
 
   u1:=a1;
-  if ord(u1[1])<>228 then
+  if ord(u1[1])<>$20AC then
     halt(4);
 
   writeln('ok');

+ 14 - 12
tests/test/tcpstransistrcompare.pp

@@ -5,25 +5,27 @@ uses
   SysUtils;
   
 type
-  ts850 = type AnsiString(850);
+  ts1252 = type AnsiString(1252);
   ts1251 = type AnsiString(1251);
 var
-  a850:ts850;
-  a1251 : ts1251;  
-  au : utf8string;
+  s1 : ts1252;
+  s2 : ts1251;
+  au : unicodestring;
 begin 
-  au := #$00AE#$00A7;
-  a850 := au; 
-  a1251 := au;
-  if (a850>a1251) then
+  au := #$20AC; // Euro symbol
+  s1 := au;
+  s2 := au;
+  if Ord(s1[1]) = Ord(s2[1]) then
+    halt(5);
+  if (s1>s2) then
     halt(1);
-  if (a850<a1251) then
+  if (s1<s2) then
     halt(2);
     
-  a850 := a850 + 'a'; 
-  if (a850<=a1251) then
+  s1 := s1 + 'a';
+  if (s1<=s2) then
     halt(3);
-  if (a1251>=a850) then
+  if (s2>=s1) then
     halt(4);
   
   writeln('ok');

+ 9 - 9
tests/test/tcpstransistrcompareequal.pp

@@ -5,17 +5,17 @@ uses
   SysUtils;
   
 type
-  ts850 = type AnsiString(850);
+  ts1252 = type AnsiString(1252);
   ts1251 = type AnsiString(1251);
 var
-  a850:ts850;
-  a1251 : ts1251;  
-  au : utf8string;
-begin 
-  au := #$00AE#$00A7;
-  a850 := au; 
-  a1251 := au;
-  if (a850<>a1251) then
+  s1 : ts1252;
+  s2 : ts1251;
+  au : unicodestring;
+begin
+  au := #$20AC; // Euro symbol
+  s1 := au;
+  s2 := au;
+  if (s1<>s2) then
     halt(1);
   writeln('ok');
 end.