瀏覽代碼

* fixed some generic and some 64 bit-specific errors in the test

git-svn-id: trunk@8458 -
Jonas Maebe 18 年之前
父節點
當前提交
c3955767ca
共有 1 個文件被更改,包括 49 次插入5 次删除
  1. 49 5
      tests/test/units/system/tval5.pp

+ 49 - 5
tests/test/units/system/tval5.pp

@@ -1,3 +1,8 @@
+{$mode objfpc}
+
+uses
+  sysutils;
+
 procedure testcard;
 procedure testcard;
 const
 const
   h = 1;
   h = 1;
@@ -8,6 +13,9 @@ var
   s: shortstring;
   s: shortstring;
   b, b2: byte;
   b, b2: byte;
   ch, ch2: char;
   ch, ch2: char;
+{$ifdef cpu64}
+  caught: boolean;
+{$endif cpu64}
 begin
 begin
   s:='$0fffffff';
   s:='$0fffffff';
   for b := low(hexch) to high(hexch) do
   for b := low(hexch) to high(hexch) do
@@ -36,8 +44,20 @@ begin
       for b := low(hexch) to high(hexch) do
       for b := low(hexch) to high(hexch) do
         begin
         begin
           s[length(s)]:=hexch[b];
           s[length(s)]:=hexch[b];
-          val(s,c,l);
+{$ifdef cpu64}
+{$r+}
+          try
+            caught:=false;
+{$endif cpu64}
+            val(s,c,l);
+{$ifdef cpu64}
+          except on e : exception do
+            caught:=true;
+          end;
+          if not caught then
+{$else cpu64}
           if (l=0) then
           if (l=0) then
+{$endif}
             halt(b2+32+h);
             halt(b2+32+h);
         end;
         end;
     end;
     end;
@@ -64,8 +84,20 @@ begin
   for ch := '6' to '9' do
   for ch := '6' to '9' do
     begin
     begin
       s[length(s)]:=ch;
       s[length(s)]:=ch;
-      val(s,c,l);
+{$ifdef cpu64}
+{$r+}
+      try
+        caught:=false;
+{$endif cpu64}
+          val(s,c,l);
+{$ifdef cpu64}
+      except on e : exception do
+        caught:=true;
+      end;
+      if not caught then
+{$else cpu64}
       if (l=0) then
       if (l=0) then
+{$endif cpu64}
         halt(ord(ch)-ord('0')+b+54+h);
         halt(ord(ch)-ord('0')+b+54+h);
     end;
     end;
 
 
@@ -76,9 +108,21 @@ begin
         s[b]:=ch2;
         s[b]:=ch2;
       for ch := '0' to '9' do
       for ch := '0' to '9' do
         begin
         begin
-          s[length(s)]:=hexch[b];
-          val(s,c,l);
+          s[length(s)]:=ch;
+{$ifdef cpu64}
+{$r+}
+          try
+            caught:=false;
+{$endif cpu64}
+            val(s,c,l);
+{$ifdef cpu64}
+          except on e : exception do
+            caught:=true;
+          end;
+          if not caught then
+{$else cpu64}
           if (l=0) then
           if (l=0) then
+{$endif cpu64}
             halt(ord(ch2)-ord('1')+65+h);
             halt(ord(ch2)-ord('1')+65+h);
         end;
         end;
     end;
     end;
@@ -164,7 +208,7 @@ begin
         s[b]:=ch2;
         s[b]:=ch2;
       for ch := '0' to '9' do
       for ch := '0' to '9' do
         begin
         begin
-          s[length(s)]:=hexch[b];
+          s[length(s)]:=ch;
           val(s,c,l);
           val(s,c,l);
           if (l=0) then
           if (l=0) then
             halt(ord(ch2)-ord('1')+61+h);
             halt(ord(ch2)-ord('1')+61+h);