Browse Source

* testing several types for Val function

git-svn-id: trunk@7140 -
pierre 18 years ago
parent
commit
1d1412c593

+ 5 - 0
.gitattributes

@@ -7017,7 +7017,12 @@ tests/test/units/system/tslice2.pp svneol=native#text/plain
 tests/test/units/system/tstring.pp svneol=native#text/plain
 tests/test/units/system/tstring.pp svneol=native#text/plain
 tests/test/units/system/ttrig.pas svneol=native#text/plain
 tests/test/units/system/ttrig.pas svneol=native#text/plain
 tests/test/units/system/ttrunc.pp svneol=native#text/plain
 tests/test/units/system/ttrunc.pp svneol=native#text/plain
+tests/test/units/system/tval.inc -text
 tests/test/units/system/tval.pp -text
 tests/test/units/system/tval.pp -text
+tests/test/units/system/tval1.pp -text
+tests/test/units/system/tval2.pp -text
+tests/test/units/system/tval3.pp -text
+tests/test/units/system/tval4.pp -text
 tests/test/units/sysutils/execansi.pp svneol=native#text/plain
 tests/test/units/sysutils/execansi.pp svneol=native#text/plain
 tests/test/units/sysutils/execedbya.pp svneol=native#text/plain
 tests/test/units/sysutils/execedbya.pp svneol=native#text/plain
 tests/test/units/sysutils/extractquote.pp svneol=native#text/plain
 tests/test/units/sysutils/extractquote.pp svneol=native#text/plain

+ 318 - 0
tests/test/units/system/tval.inc

@@ -0,0 +1,318 @@
+
+{ Included by several source with different
+  definitions of the type
+  IntegerType
+  to check that the test is working for
+  all basic integer types }
+
+
+
+const
+  HasErrors : boolean = false;
+  Silent : boolean = true;
+  CheckVal : boolean = true;
+  SuccessCount : longint = 0;
+  FailCount : longint = 0;
+
+type
+  TCharSet = set of char;
+const
+  ValidNumeralsBase2 : TCHarSet = ['0'..'1'];
+  ValidNumeralsBase8 : TCHarSet = ['0'..'7'];
+  ValidNumeralsBase10 : TCHarSet = ['0'..'9'];
+  ValidNumeralsBase16 : TCHarSet = ['0'..'9','a'..'f','A'..'F'];
+  SpecialCharsFirst : TCharSet = [' ',#9,'x','X','$','&','%','+','-'];
+  SpecialCharsSecond : TCharSet = [#0];
+
+type
+
+  ValTestType =
+  (ValShouldFail,
+   ValShouldSucceed,
+   ValShouldSucceedAfterRemovingTrail);
+
+
+function Display(const s : string) : string;
+var
+  res,ordval : string;
+  i : longint;
+  quoted : boolean;
+begin
+  res:='"';
+  quoted:=false;
+  for i:=1 to length(s) do
+    if ord(s[i])<32 then
+      begin
+        if quoted then
+          res:=res+'''';
+        str(ord(s[i]),ordval);
+        res:=res+'#'+ordval;
+        quoted:=false;
+      end
+    else
+      begin
+        if not quoted then
+          res:=res+'''';
+        quoted:=true;
+        res:=res+s[i];
+      end;
+  if quoted then
+    res:=res+'''';
+  res:=res+'"';
+  Display:=res;
+end;
+
+procedure TestVal(comment,s : string; ExpectedRes : ValTestType; expected : IntegerType);
+var
+  i : IntegerType;
+  err,err1 : word;
+  OK : boolean;
+begin
+  OK:=false;
+  if not silent and (Comment<>'') then
+    Writeln(Comment);
+  Val(s,i,err);
+  if ExpectedRes=ValShouldFail then
+    begin
+      if err=0 then
+        begin
+          if not silent or not HasErrors then
+            Writeln('Error: string ',Display(s),
+              ' is a valid input for val function');
+          HasErrors:=true;
+        end
+      else
+        begin
+          OK:=true;
+          if not silent then
+            Writeln('Correct: string ',Display(s),
+              ' is a not valid input for val function');
+        end;
+    end
+  else if ExpectedRes=ValShouldSucceed then
+    begin
+      if err=0 then
+        begin
+          OK:=true;
+          if not silent then
+            Writeln('Correct: string ',Display(s),
+              ' is a valid input for val function');
+        end
+      else
+        begin
+          if not silent or not HasErrors then
+            Writeln('Error: string ',Display(s),
+              ' is a not valid input for val function',
+              ' error pos=',err);
+          HasErrors:=true;
+        end;
+    end
+  else if ExpectedRes=ValShouldSucceedAfterRemovingTrail then
+    begin
+      if err=0 then
+        begin
+          if not silent or not HasErrors then
+            Writeln('Error: string ',Display(s),
+              ' is a valid input for val function');
+          HasErrors:=true;
+        end
+      else
+        begin
+          err1:=err;
+          Val(Copy(s,1,err1-1),i,err);
+          if err=0 then
+            begin
+              OK:=true;
+              if not silent then
+                Writeln('Correct: string ',Display(s),
+                  ' is a valid input for val function up to position ',err1);
+            end
+          else
+            begin
+              if not silent or not HasErrors then
+                Writeln('Error: string ',Display(Copy(s,1,err1-1)),
+                  ' is a not valid input for val function',
+                  ' error pos=',err);
+              HasErrors:=true;
+            end;
+        end;
+    end;
+  if (err=0) and CheckVal and (i<>expected) then
+    begin
+      OK:=false;
+      if not silent or not HasErrors then
+        Writeln('Error: string ',Display(s),
+          ' value is ',i,' <> ',expected);
+      HasErrors:=true;
+    end;
+  if OK then
+    inc(SuccessCount)
+  else
+    inc(FailCount);
+end;
+
+Procedure TestBase(Const Prefix : string;ValidChars : TCharSet);
+var
+  i,j : longint;
+  st : string;
+begin
+  CheckVal:=false;
+  Silent:=true;
+  for i:=0 to 255 do
+    begin
+      st:=prefix+chr(i);
+      if chr(i) in ValidChars then
+        TestVal('',st,ValShouldSucceed,0)
+      else
+        TestVal('',st,ValShouldFail,0);
+    end;
+  for i:=0 to 255 do
+    for j:=0 to 255 do
+      begin
+        st:=prefix+chr(i)+chr(j);
+        if (chr(i) in ValidChars) and
+           (chr(j) in ValidChars) then
+          TestVal('',st,ValShouldSucceed,0)
+        else
+          begin
+            if ((prefix<>'') or
+               (not (chr(i) in SpecialCharsFirst))) and
+                not (chr(j) in SpecialCharsSecond) then
+              TestVal('',st,ValShouldFail,0);
+          end;
+      end;
+end;
+
+
+Function TestAll : boolean;
+
+var
+  S : string;
+begin
+  TestVal('Testing empty string','',ValShouldFail,0);
+  TestVal('Testing string with #0',#0,ValShouldFail,0);
+  TestVal('Testing string with base prefix and no value','0x',ValShouldFail,0);
+  TestVal('Testing string with base prefix and no value','x',ValShouldFail,0);
+  TestVal('Testing string with base prefix and no value','X',ValShouldFail,0);
+  TestVal('Testing string with base prefix and no value','$',ValShouldFail,0);
+  TestVal('Testing string with base prefix and no value','%',ValShouldFail,0);
+  TestVal('Testing string with base prefix and no value','&',ValShouldFail,0);
+  TestVal('Testing string with base prefix and #0','0x'#0,ValShouldFail,0);
+  TestVal('Testing normal ''''0'''' string','0',ValShouldSucceed,0);
+  TestVal('Testing leading space',' 0',ValShouldSucceed,0);
+  TestVal('Testing leading 2 spaces','  0',ValShouldSucceed,0);
+  TestVal('Testing leading 2 tabs',#9#9'0',ValShouldSucceed,0);
+  TestVal('Testing leading 3 spaces','   0',ValShouldSucceed,0);
+  TestVal('Testing leading 3 tabs',#9#9#9'0',ValShouldSucceed,0);
+  TestVal('Testing leading space/tab combination',#9' 0',ValShouldSucceed,0);
+  TestVal('Testing leading space/tab combination',' '#9'0',ValShouldSucceed,0);
+  TestVal('Testing leading space/tab combination',' '#9' 0',ValShouldSucceed,0);
+  TestVal('Testing leading space/tab combination',#9' '#9' 0',ValShouldSucceed,0);
+  TestVal('Testing #0 following normal ''''0''','0'#0,ValShouldSucceed,0);
+  TestVal('Testing leading space with trailing #0',' 0'#0,ValShouldSucceed,0);
+  TestVal('Testing leading 2 spaces with trailing #0','  0'#0,ValShouldSucceed,0);
+  TestVal('Testing leading 2 tabs with trailing #0',#9#9'0'#0,ValShouldSucceed,0);
+  TestVal('Testing leading 3 spaces with trailing #0','   0'#0,ValShouldSucceed,0);
+  TestVal('Testing leading 3 tabs with trailing #0',#9#9#9'0'#0,ValShouldSucceed,0);
+  TestVal('Testing leading space/tab combination with trailing #0',#9' 0'#0,ValShouldSucceed,0);
+  TestVal('Testing leading space/tab combination with trailing #0',' '#9'0'#0,ValShouldSucceed,0);
+  TestVal('Testing leading space/tab combination with trailing #0',' '#9' 0'#0,ValShouldSucceed,0);
+  TestVal('Testing leading space/tab combination with trailing #0',#9' '#9' 0'#0,ValShouldSucceed,0);
+  TestVal('Testing trailing space','0 ',ValShouldSucceedAfterRemovingTrail,0);
+  TestVal('Testing trailing 2 spaces','0  ',ValShouldSucceedAfterRemovingTrail,0);
+  TestVal('Testing trailing 2 tabs','0'#9#9,ValShouldSucceedAfterRemovingTrail,0);
+  TestVal('Testing trailing 3 spaces','0   ',ValShouldSucceedAfterRemovingTrail,0);
+  TestVal('Testing trailing 3 tabs','0'#9#9#9,ValShouldSucceedAfterRemovingTrail,0);
+  TestVal('Testing trailing space/tab combination','0'#9' ',ValShouldSucceedAfterRemovingTrail,0);
+  TestVal('Testing trailing space/tab combination','0 '#9,ValShouldSucceedAfterRemovingTrail,0);
+  TestVal('Testing trailing space/tab combination','0 '#9' ',ValShouldSucceedAfterRemovingTrail,0);
+  TestVal('Testing trailing space/tab combination','0'#9' '#9' ',ValShouldSucceedAfterRemovingTrail,0);
+  TestVal('Testing several zeroes',' 00'#0,ValShouldSucceed,0);
+  TestVal('Testing normal zero','0',ValShouldSucceed,0);
+  TestVal('Testing several zeroes','00',ValShouldSucceed,0);
+  TestVal('Testing normal zero with leading space',' 0',ValShouldSucceed,0);
+  TestVal('Testing several zeroes with leading space',' 00',ValShouldSucceed,0);
+  TestVal('Testing string with base prefix and zero','0x0',ValShouldSucceed,0);
+  TestVal('Testing string with base prefix and zero','x0',ValShouldSucceed,0);
+  TestVal('Testing string with base prefix and zero','X0',ValShouldSucceed,0);
+  TestVal('Testing string with base prefix and zero','$0',ValShouldSucceed,0);
+  TestVal('Testing string with base prefix and zero','%0',ValShouldSucceed,0);
+  TestVal('Testing string with base prefix and zero','&0',ValShouldSucceed,0);
+  TestVal('Testing string with base prefix and one','0x1',ValShouldSucceed,1);
+  TestVal('Testing string with base prefix and one','x1',ValShouldSucceed,1);
+  TestVal('Testing string with base prefix and one','X1',ValShouldSucceed,1);
+  TestVal('Testing string with base prefix and one','$1',ValShouldSucceed,1);
+  TestVal('Testing string with base prefix and one','%1',ValShouldSucceed,1);
+  TestVal('Testing string with base prefix and one','&1',ValShouldSucceed,1);
+  TestVal('Testing string with base prefix and two','0x2',ValShouldSucceed,2);
+  TestVal('Testing string with base prefix and two','x2',ValShouldSucceed,2);
+  TestVal('Testing string with base prefix and two','X2',ValShouldSucceed,2);
+  TestVal('Testing string with base prefix and two','$2',ValShouldSucceed,2);
+  TestVal('Testing string with base prefix and two','%2',ValShouldFail,0);
+  TestVal('Testing string with base prefix and two','&2',ValShouldSucceed,2);
+  TestVal('Testing string with base prefix and seven','0x7',ValShouldSucceed,7);
+  TestVal('Testing string with base prefix and seven','x7',ValShouldSucceed,7);
+  TestVal('Testing string with base prefix and seven','X7',ValShouldSucceed,7);
+  TestVal('Testing string with base prefix and seven','$7',ValShouldSucceed,7);
+  TestVal('Testing string with base prefix and seven','%7',ValShouldFail,0);
+  TestVal('Testing string with base prefix and seven','&7',ValShouldSucceed,7);
+  TestVal('Testing string with base prefix and eight','0x8',ValShouldSucceed,8);
+  TestVal('Testing string with base prefix and eight','x8',ValShouldSucceed,8);
+  TestVal('Testing string with base prefix and eight','X8',ValShouldSucceed,8);
+  TestVal('Testing string with base prefix and eight','$8',ValShouldSucceed,8);
+  TestVal('Testing string with base prefix and eight','%8',ValShouldFail,0);
+  TestVal('Testing string with base prefix and eight','&8',ValShouldFail,0);
+  TestVal('Testing string with base prefix and nine','0x9',ValShouldSucceed,9);
+  TestVal('Testing string with base prefix and nine','x9',ValShouldSucceed,9);
+  TestVal('Testing string with base prefix and nine','X9',ValShouldSucceed,9);
+  TestVal('Testing string with base prefix and nine','$9',ValShouldSucceed,9);
+  TestVal('Testing string with base prefix and nine','%9',ValShouldFail,0);
+  TestVal('Testing string with base prefix and nine','&9',ValShouldFail,0);
+  TestVal('Testing string with base prefix and "a"','0xa',ValShouldSucceed,10);
+  TestVal('Testing string with base prefix and "a"','xa',ValShouldSucceed,10);
+  TestVal('Testing string with base prefix and "a"','Xa',ValShouldSucceed,10);
+  TestVal('Testing string with base prefix and "a"','$a',ValShouldSucceed,10);
+  TestVal('Testing string with base prefix and "a"','%a',ValShouldFail,0);
+  TestVal('Testing string with base prefix and "a"','&a',ValShouldFail,0);
+  TestVal('Testing string with base prefix and "A"','0xA',ValShouldSucceed,10);
+  TestVal('Testing string with base prefix and "A"','xA',ValShouldSucceed,10);
+  TestVal('Testing string with base prefix and "A"','XA',ValShouldSucceed,10);
+  TestVal('Testing string with base prefix and "A"','$A',ValShouldSucceed,10);
+  TestVal('Testing string with base prefix and "A"','%A',ValShouldFail,0);
+  TestVal('Testing string with base prefix and "A"','&A',ValShouldFail,0);
+  TestVal('Testing string with base prefix and "f"','0xf',ValShouldSucceed,15);
+  TestVal('Testing string with base prefix and "f"','xf',ValShouldSucceed,15);
+  TestVal('Testing string with base prefix and "f"','Xf',ValShouldSucceed,15);
+  TestVal('Testing string with base prefix and "f"','$f',ValShouldSucceed,15);
+  TestVal('Testing string with base prefix and "f"','%f',ValShouldFail,0);
+  TestVal('Testing string with base prefix and "f"','&f',ValShouldFail,0);
+  TestVal('Testing string with base prefix and "F"','0xF',ValShouldSucceed,15);
+  TestVal('Testing string with base prefix and "F"','xF',ValShouldSucceed,15);
+  TestVal('Testing string with base prefix and "F"','XF',ValShouldSucceed,15);
+  TestVal('Testing string with base prefix and "F"','$F',ValShouldSucceed,15);
+  TestVal('Testing string with base prefix and "F"','%F',ValShouldFail,0);
+  TestVal('Testing string with base prefix and "F"','&F',ValShouldFail,0);
+
+  TestVal('Testing -zero','-0',ValShouldSucceed,0);
+  TestVal('Testing +zero','+0',ValShouldSucceed,0);
+  TestVal('Testing - zero','- 0',ValShouldFail,0);
+  TestVal('Testing + zero','+ 0',ValShouldFail,0);
+  TestVal('Testing --zero','--0',ValShouldFail,0);
+  TestVal('Testing ++zero','++0',ValShouldFail,0);
+  TestVal('Testing -+zero','-+0',ValShouldFail,0);
+
+  TestBase('%', ValidNumeralsBase2);
+  TestBase('&', ValidNumeralsBase8);
+  TestBase('', ValidNumeralsBase10);
+  TestBase('0x', ValidNumeralsBase16);
+
+  if HasErrors then
+    begin
+      Writeln(FailCount,' tests failed over ',SuccessCount+FailCount);
+    end
+  else
+    Writeln('All tests succeeded count=',SuccessCount);
+  TestAll:=HasErrors;
+
+end;
+

+ 14 - 296
tests/test/units/system/tval.pp

@@ -1,303 +1,21 @@
 
 
-const
-  HasErrors : boolean = false;
-  Silent : boolean = false;
-  CheckVal : boolean = true;
-  SuccessCount : longint = 0;
-  FailCount : longint = 0;
+program TestVal;
 
 
-type
-  TCharSet = set of char;
-const
-  ValidNumeralsBase2 : TCHarSet = ['0'..'1'];
-  ValidNumeralsBase8 : TCHarSet = ['0'..'7'];
-  ValidNumeralsBase10 : TCHarSet = ['0'..'9'];
-  ValidNumeralsBase16 : TCHarSet = ['0'..'9','a'..'f','A'..'F'];
-  SpecialCharsFirst : TCharSet = [' ',#9,'x','X','$','&','%','+','-'];
-  SpecialCharsSecond : TCharSet = [#0];
+uses
+  { longint type, short string }
+  tval1,
+  { dword type, short string }
+  tval2,
+  { int64 type, short string }
+  tval3,
+  { uint64 type, short string }
+  tval4;
 
 
-type
 
 
-  ValTestType =
-  (ValShouldFail,
-   ValShouldSucceed,
-   ValShouldSucceedAfterRemovingTrail);
 
 
-
-function Display(const s : string) : string;
-var
-  res,ordval : string;
-  i : longint;
-  quoted : boolean;
-begin
-  res:='"';
-  quoted:=false;
-  for i:=1 to length(s) do
-    if ord(s[i])<32 then
-      begin
-        if quoted then
-          res:=res+'''';
-        str(ord(s[i]),ordval);
-        res:=res+'#'+ordval;
-        quoted:=false;
-      end
-    else
-      begin
-        if not quoted then
-          res:=res+'''';
-        quoted:=true;
-        res:=res+s[i];
-      end;
-  if quoted then
-    res:=res+'''';
-  res:=res+'"';
-  Display:=res;
-end;
-
-procedure TestVal(comment,s : string; ExpectedRes : ValTestType; expected : longint);
-var
-  i : longint;
-  err,err1 : word;
-  OK : boolean;
-begin
-  OK:=false;
-  if not silent and (Comment<>'') then
-    Writeln(Comment);
-  Val(s,i,err);
-  if ExpectedRes=ValShouldFail then
-    begin
-      if err=0 then
-        begin
-          Writeln('Error: string ',Display(s),
-            ' is a valid input for val function');
-          HasErrors:=true;
-        end
-      else
-        begin
-          OK:=true;
-          if not silent then
-            Writeln('Correct: string ',Display(s),
-              ' is a not valid input for val function');
-        end;
-    end
-  else if ExpectedRes=ValShouldSucceed then
-    begin
-      if err=0 then
-        begin
-          OK:=true;
-          if not silent then
-            Writeln('Correct: string ',Display(s),
-              ' is a valid input for val function');
-        end
-      else
-        begin
-          Writeln('Error: string ',Display(s),
-            ' is a not valid input for val function',
-            ' error pos=',err);
-          HasErrors:=true;
-        end;
-    end
-  else if ExpectedRes=ValShouldSucceedAfterRemovingTrail then
-    begin
-      if err=0 then
-        begin
-          Writeln('Error: string ',Display(s),
-            ' is a valid input for val function');
-          HasErrors:=true;
-        end
-      else
-        begin
-          err1:=err;
-          Val(Copy(s,1,err1-1),i,err);
-          if err=0 then
-            begin
-              OK:=true;
-              if not silent then
-                Writeln('Correct: string ',Display(s),
-                  ' is a valid input for val function up to position ',err1);
-            end
-          else
-            begin
-              Writeln('Error: string ',Display(Copy(s,1,err1-1)),
-                ' is a not valid input for val function',
-                ' error pos=',err);
-              HasErrors:=true;
-            end;
-        end;
-    end;
-  if (err=0) and CheckVal and (i<>expected) then
-    begin
-      OK:=false;
-      Writeln('Error: string ',Display(s),
-        ' value is ',i,' <> ',expected);
-          HasErrors:=true;
-    end;
-  if OK then
-    inc(SuccessCount)
-  else
-    inc(FailCount);
-end;
-
-Procedure TestBase(Const Prefix : string;ValidChars : TCharSet);
-var
-  i,j : longint;
-  st : string;
 begin
 begin
-  CheckVal:=false;
-  Silent:=true;
-  for i:=0 to 255 do
-    begin
-      st:=prefix+chr(i);
-      if chr(i) in ValidChars then
-        TestVal('',st,ValShouldSucceed,0)
-      else
-        TestVal('',st,ValShouldFail,0);
-    end;
-  for i:=0 to 255 do
-    for j:=0 to 255 do
-      begin
-        st:=prefix+chr(i)+chr(j);
-        if (chr(i) in ValidChars) and
-           (chr(j) in ValidChars) then
-          TestVal('',st,ValShouldSucceed,0)
-        else
-          begin
-            if ((prefix<>'') or
-               (not (chr(i) in SpecialCharsFirst))) and
-                not (chr(j) in SpecialCharsSecond) then
-              TestVal('',st,ValShouldFail,0);
-          end;
-      end;
-end;
-
-var
-  S : string;
-begin
-  if (paramcount>0) and
-     (paramstr(1)='silent') then
-       silent:=true;
-  TestVal('Testing empty string','',ValShouldFail,0);
-  TestVal('Testing string with #0',#0,ValShouldFail,0);
-  TestVal('Testing string with base prefix and no value','0x',ValShouldFail,0);
-  TestVal('Testing string with base prefix and no value','x',ValShouldFail,0);
-  TestVal('Testing string with base prefix and no value','X',ValShouldFail,0);
-  TestVal('Testing string with base prefix and no value','$',ValShouldFail,0);
-  TestVal('Testing string with base prefix and no value','%',ValShouldFail,0);
-  TestVal('Testing string with base prefix and no value','&',ValShouldFail,0);
-  TestVal('Testing string with base prefix and #0','0x'#0,ValShouldFail,0);
-  TestVal('Testing normal ''''0'''' string','0',ValShouldSucceed,0);
-  TestVal('Testing leading space',' 0',ValShouldSucceed,0);
-  TestVal('Testing leading 2 spaces','  0',ValShouldSucceed,0);
-  TestVal('Testing leading 2 tabs',#9#9'0',ValShouldSucceed,0);
-  TestVal('Testing leading 3 spaces','   0',ValShouldSucceed,0);
-  TestVal('Testing leading 3 tabs',#9#9#9'0',ValShouldSucceed,0);
-  TestVal('Testing leading space/tab combination',#9' 0',ValShouldSucceed,0);
-  TestVal('Testing leading space/tab combination',' '#9'0',ValShouldSucceed,0);
-  TestVal('Testing leading space/tab combination',' '#9' 0',ValShouldSucceed,0);
-  TestVal('Testing leading space/tab combination',#9' '#9' 0',ValShouldSucceed,0);
-  TestVal('Testing #0 following normal ''''0''','0'#0,ValShouldSucceed,0);
-  TestVal('Testing leading space with trailing #0',' 0'#0,ValShouldSucceed,0);
-  TestVal('Testing leading 2 spaces with trailing #0','  0'#0,ValShouldSucceed,0);
-  TestVal('Testing leading 2 tabs with trailing #0',#9#9'0'#0,ValShouldSucceed,0);
-  TestVal('Testing leading 3 spaces with trailing #0','   0'#0,ValShouldSucceed,0);
-  TestVal('Testing leading 3 tabs with trailing #0',#9#9#9'0'#0,ValShouldSucceed,0);
-  TestVal('Testing leading space/tab combination with trailing #0',#9' 0'#0,ValShouldSucceed,0);
-  TestVal('Testing leading space/tab combination with trailing #0',' '#9'0'#0,ValShouldSucceed,0);
-  TestVal('Testing leading space/tab combination with trailing #0',' '#9' 0'#0,ValShouldSucceed,0);
-  TestVal('Testing leading space/tab combination with trailing #0',#9' '#9' 0'#0,ValShouldSucceed,0);
-  TestVal('Testing trailing space','0 ',ValShouldSucceedAfterRemovingTrail,0);
-  TestVal('Testing trailing 2 spaces','0  ',ValShouldSucceedAfterRemovingTrail,0);
-  TestVal('Testing trailing 2 tabs','0'#9#9,ValShouldSucceedAfterRemovingTrail,0);
-  TestVal('Testing trailing 3 spaces','0   ',ValShouldSucceedAfterRemovingTrail,0);
-  TestVal('Testing trailing 3 tabs','0'#9#9#9,ValShouldSucceedAfterRemovingTrail,0);
-  TestVal('Testing trailing space/tab combination','0'#9' ',ValShouldSucceedAfterRemovingTrail,0);
-  TestVal('Testing trailing space/tab combination','0 '#9,ValShouldSucceedAfterRemovingTrail,0);
-  TestVal('Testing trailing space/tab combination','0 '#9' ',ValShouldSucceedAfterRemovingTrail,0);
-  TestVal('Testing trailing space/tab combination','0'#9' '#9' ',ValShouldSucceedAfterRemovingTrail,0);
-  TestVal('Testing several zeroes',' 00'#0,ValShouldSucceed,0);
-  TestVal('Testing normal zero','0',ValShouldSucceed,0);
-  TestVal('Testing several zeroes','00',ValShouldSucceed,0);
-  TestVal('Testing normal zero with leading space',' 0',ValShouldSucceed,0);
-  TestVal('Testing several zeroes with leading space',' 00',ValShouldSucceed,0);
-  TestVal('Testing string with base prefix and zero','0x0',ValShouldSucceed,0);
-  TestVal('Testing string with base prefix and zero','x0',ValShouldSucceed,0);
-  TestVal('Testing string with base prefix and zero','X0',ValShouldSucceed,0);
-  TestVal('Testing string with base prefix and zero','$0',ValShouldSucceed,0);
-  TestVal('Testing string with base prefix and zero','%0',ValShouldSucceed,0);
-  TestVal('Testing string with base prefix and zero','&0',ValShouldSucceed,0);
-  TestVal('Testing string with base prefix and one','0x1',ValShouldSucceed,1);
-  TestVal('Testing string with base prefix and one','x1',ValShouldSucceed,1);
-  TestVal('Testing string with base prefix and one','X1',ValShouldSucceed,1);
-  TestVal('Testing string with base prefix and one','$1',ValShouldSucceed,1);
-  TestVal('Testing string with base prefix and one','%1',ValShouldSucceed,1);
-  TestVal('Testing string with base prefix and one','&1',ValShouldSucceed,1);
-  TestVal('Testing string with base prefix and two','0x2',ValShouldSucceed,2);
-  TestVal('Testing string with base prefix and two','x2',ValShouldSucceed,2);
-  TestVal('Testing string with base prefix and two','X2',ValShouldSucceed,2);
-  TestVal('Testing string with base prefix and two','$2',ValShouldSucceed,2);
-  TestVal('Testing string with base prefix and two','%2',ValShouldFail,0);
-  TestVal('Testing string with base prefix and two','&2',ValShouldSucceed,2);
-  TestVal('Testing string with base prefix and seven','0x7',ValShouldSucceed,7);
-  TestVal('Testing string with base prefix and seven','x7',ValShouldSucceed,7);
-  TestVal('Testing string with base prefix and seven','X7',ValShouldSucceed,7);
-  TestVal('Testing string with base prefix and seven','$7',ValShouldSucceed,7);
-  TestVal('Testing string with base prefix and seven','%7',ValShouldFail,0);
-  TestVal('Testing string with base prefix and seven','&7',ValShouldSucceed,7);
-  TestVal('Testing string with base prefix and eight','0x8',ValShouldSucceed,8);
-  TestVal('Testing string with base prefix and eight','x8',ValShouldSucceed,8);
-  TestVal('Testing string with base prefix and eight','X8',ValShouldSucceed,8);
-  TestVal('Testing string with base prefix and eight','$8',ValShouldSucceed,8);
-  TestVal('Testing string with base prefix and eight','%8',ValShouldFail,0);
-  TestVal('Testing string with base prefix and eight','&8',ValShouldFail,0);
-  TestVal('Testing string with base prefix and nine','0x9',ValShouldSucceed,9);
-  TestVal('Testing string with base prefix and nine','x9',ValShouldSucceed,9);
-  TestVal('Testing string with base prefix and nine','X9',ValShouldSucceed,9);
-  TestVal('Testing string with base prefix and nine','$9',ValShouldSucceed,9);
-  TestVal('Testing string with base prefix and nine','%9',ValShouldFail,0);
-  TestVal('Testing string with base prefix and nine','&9',ValShouldFail,0);
-  TestVal('Testing string with base prefix and "a"','0xa',ValShouldSucceed,10);
-  TestVal('Testing string with base prefix and "a"','xa',ValShouldSucceed,10);
-  TestVal('Testing string with base prefix and "a"','Xa',ValShouldSucceed,10);
-  TestVal('Testing string with base prefix and "a"','$a',ValShouldSucceed,10);
-  TestVal('Testing string with base prefix and "a"','%a',ValShouldFail,0);
-  TestVal('Testing string with base prefix and "a"','&a',ValShouldFail,0);
-  TestVal('Testing string with base prefix and "A"','0xA',ValShouldSucceed,10);
-  TestVal('Testing string with base prefix and "A"','xA',ValShouldSucceed,10);
-  TestVal('Testing string with base prefix and "A"','XA',ValShouldSucceed,10);
-  TestVal('Testing string with base prefix and "A"','$A',ValShouldSucceed,10);
-  TestVal('Testing string with base prefix and "A"','%A',ValShouldFail,0);
-  TestVal('Testing string with base prefix and "A"','&A',ValShouldFail,0);
-  TestVal('Testing string with base prefix and "f"','0xf',ValShouldSucceed,15);
-  TestVal('Testing string with base prefix and "f"','xf',ValShouldSucceed,15);
-  TestVal('Testing string with base prefix and "f"','Xf',ValShouldSucceed,15);
-  TestVal('Testing string with base prefix and "f"','$f',ValShouldSucceed,15);
-  TestVal('Testing string with base prefix and "f"','%f',ValShouldFail,0);
-  TestVal('Testing string with base prefix and "f"','&f',ValShouldFail,0);
-  TestVal('Testing string with base prefix and "F"','0xF',ValShouldSucceed,15);
-  TestVal('Testing string with base prefix and "F"','xF',ValShouldSucceed,15);
-  TestVal('Testing string with base prefix and "F"','XF',ValShouldSucceed,15);
-  TestVal('Testing string with base prefix and "F"','$F',ValShouldSucceed,15);
-  TestVal('Testing string with base prefix and "F"','%F',ValShouldFail,0);
-  TestVal('Testing string with base prefix and "F"','&F',ValShouldFail,0);
-
-  TestVal('Testing -zero','-0',ValShouldSucceed,0);
-  TestVal('Testing +zero','+0',ValShouldSucceed,0);
-  TestVal('Testing - zero','- 0',ValShouldFail,0);
-  TestVal('Testing + zero','+ 0',ValShouldFail,0);
-  TestVal('Testing --zero','--0',ValShouldFail,0);
-  TestVal('Testing ++zero','++0',ValShouldFail,0);
-  TestVal('Testing -+zero','-+0',ValShouldFail,0);
-
-  TestBase('%', ValidNumeralsBase2);
-  TestBase('&', ValidNumeralsBase8);
-  TestBase('', ValidNumeralsBase10);
-  TestBase('0x', ValidNumeralsBase16);
-
-  if HasErrors then
-    begin
-      Writeln(FailCount,' tests failed over ',SuccessCount+FailCount);
-      Halt(1);
-    end
-  else
-    Writeln('All tests succeeded count=',SuccessCount);
+  TestAllVal1;
+  TestAllVal2;
+  TestAllVal3;
+  TestAllVal4;
 end.
 end.

+ 27 - 0
tests/test/units/system/tval1.pp

@@ -0,0 +1,27 @@
+
+unit tval1;
+
+{$mode fpc}
+
+interface
+
+function TestAllVal1 : boolean;
+
+implementation
+
+type
+  IntegerType = longint;
+
+{$i tval.inc}
+
+
+function TestAllVal1 : boolean;
+begin
+  if (paramcount>0) and
+     (paramstr(1)='verbose') then
+       silent:=false;
+  Writeln('Test val for longint type');
+  TestAllVal1:=TestAll;
+end;
+
+end.

+ 27 - 0
tests/test/units/system/tval2.pp

@@ -0,0 +1,27 @@
+
+unit tval2;
+
+{$mode fpc}
+
+interface
+
+function TestAllval2 : boolean;
+
+implementation
+
+type
+  IntegerType = dword;
+
+{$i tval.inc}
+
+
+function TestAllval2 : boolean;
+begin
+  if (paramcount>0) and
+     (paramstr(1)='verbose') then
+       silent:=false;
+  Writeln('Test val for dword type');
+  TestAllval2:=TestAll;
+end;
+
+end.

+ 27 - 0
tests/test/units/system/tval3.pp

@@ -0,0 +1,27 @@
+
+unit tval3;
+
+{$mode fpc}
+
+interface
+
+function TestAllval3 : boolean;
+
+implementation
+
+type
+  IntegerType = int64;
+
+{$i tval.inc}
+
+
+function TestAllval3 : boolean;
+begin
+  if (paramcount>0) and
+     (paramstr(1)='verbose') then
+       silent:=false;
+  Writeln('Test val for int64 type');
+  TestAllval3:=TestAll;
+end;
+
+end.

+ 27 - 0
tests/test/units/system/tval4.pp

@@ -0,0 +1,27 @@
+
+unit tval4;
+
+{$mode fpc}
+
+interface
+
+function TestAllval4 : boolean;
+
+implementation
+
+type
+  IntegerType = qword;
+
+{$i tval.inc}
+
+
+function TestAllval4 : boolean;
+begin
+  if (paramcount>0) and
+     (paramstr(1)='verbose') then
+       silent:=false;
+  Writeln('Test val for qword type');
+  TestAllval4:=TestAll;
+end;
+
+end.