Test suite results for test file test/cg/tstr.pp

Test run data :

Free Pascal Compiler Test Suite Results

View Test suite results

Please specify search criteria:
File:
Operating system:
Processor:
Version
Date
Submitter
Machine
Comment
Limit
Cond
Category
Only failed tests
Hide skipped tests
List all tests

Test file "test/cg/tstr.pp" information:

t_id 204
t_adddate 2003/10/03
t_result 0
t_knownrunerror 0

Detailed test run results:

Record count: 50

Total = 50

OK=50 Percentage= 100.00

Result type Cat. Count Percentage First date Last Date
Successfully run 50 100.0 2024/10/19 07:29:00 50 2024/10/19 13:34:00 29
i386 5 10.0 2024/10/19 08:55:00 60 2024/10/19 10:27:00 65
m68k 3 6.0 2024/10/19 07:29:00 50 2024/10/19 10:22:00 40
sparc 4 8.0 2024/10/19 08:05:00 45 2024/10/19 11:16:00 40
powerpc 6 12.0 2024/10/19 08:40:00 51 2024/10/19 12:56:00 67
arm 2 4.0 2024/10/19 09:36:00 32 2024/10/19 10:03:00 32
x86_64 10 20.0 2024/10/19 08:27:00 30 2024/10/19 13:34:00 29
powerpc64 9 18.0 2024/10/19 08:43:00 65 2024/10/19 11:23:00 69
mips 2 4.0 2024/10/19 09:54:00 35 2024/10/19 10:28:00 38
mipsel 1 2.0 2024/10/19 10:35:00 142 2024/10/19 10:35:00 142
aarch64 4 8.0 2024/10/19 08:15:00 27 2024/10/19 09:32:00 28
sparc64 3 6.0 2024/10/19 09:25:00 118 2024/10/19 11:33:00 117
riscv64 1 2.0 2024/10/19 11:10:00 26 2024/10/19 11:10:00 26
linux 32 64.0 2024/10/19 07:29:00 50 2024/10/19 11:38:00 25
go32v2 3 6.0 2024/10/19 08:55:00 60 2024/10/19 10:27:00 65
solaris 7 14.0 2024/10/19 13:22:00 24 2024/10/19 13:34:00 29
aix 8 16.0 2024/10/19 08:40:00 51 2024/10/19 12:56:00 67
3.3.1 29 58.0 2024/10/19 08:05:00 45 2024/10/19 12:56:00 67
3.2.3 21 42.0 2024/10/19 07:29:00 50 2024/10/19 13:34:00 29

Source:

{$ifdef fpc}
  {$ifndef ver1_0}
    {$define haswidestring}
  {$endif}
{$else}
  {$ifndef ver70}
    {$define haswidestring}
  {$endif}
{$endif}

procedure test_shortstr;
type
  tlocalstring = shortstring;
var
  l: longint;
  c: cardinal;
  f: real;
  i: int64;
  q: qword;
  s: tlocalstring;
  len: byte;
  frac: word;
  longval : longint;

  procedure check(const ss: tlocalstring);
  begin
    if s <> ss then
      begin
        writeln('error!');
        halt(1);
      end;
  end;

begin
  writeln('testing str(,shortstring)...');

  l := -1;
  str(l,s);
  check('-1');
  str(l:0,s);
  check('-1');
  str(l:1,s);
  check('-1');
  str(l:2,s);
  check('-1');
  str(l:3,s);
  check(' -1');
  len := 4;
  str(l:len,s);
  check('  -1');

  c := 10;
  str(c,s);
  check('10');
  str(c:0,s);
  check('10');
  str(c:1,s);
  check('10');
  str(c:2,s);
  check('10');
  str(c:3,s);
  check(' 10');

  { for more in-depth tests of str_real, see ../tstreal[1,2].pp }
  f := -1.12345;
{$IFOPT E-}  
  str(f,s);
  if sizeof(extended) = 10 then
    check('-1.123450000000000E+000')
  else if sizeof(extended) = 8 then
    check('-1.12345000000000E+000')
  else
    check('error, not yet implemented!!!!');
{$endif}  
  { the number of exponents depends on the maaping of the real type }
  if sizeof(real) = 8 then
    begin
      str(f:0,s);
      check('-1.1E+000');
      str(f:1,s);
      check('-1.1E+000');
      str(f:2,s);
      check('-1.1E+000');
      str(f:3,s);
      check('-1.1E+000');
      str(f:4,s);
      check('-1.1E+000');
    end
  else
    begin
      str(f:0,s);
      check('-1.1E+00');
      str(f:1,s);
      check('-1.1E+00');
      str(f:2,s);
      check('-1.1E+00');
      str(f:3,s);
      check('-1.1E+00');
      str(f:4,s);
      check('-1.1E+00');
    end;
  str(f:0:0,s);
  check('-1');
  str(f:0:1,s);
  check('-1.1');
  str(f:0:2,s);
  check('-1.12');
  str(f:1:0,s);
  check('-1');
  str(f:1:1,s);
  check('-1.1');
  str(f:5:0,s);
  check('   -1');
  str(f:5:1,s);
  check(' -1.1');
  str(f:5:2,s);
  check('-1.12');
  len := 6;
  frac := 2;
  str(f:len:frac,s);
  check(' -1.12');

  i := -1;
  str(i,s);
  check('-1');
  str(i:0,s);
  check('-1');
  str(i:1,s);
  check('-1');
  str(i:2,s);
  check('-1');
  str(i:3,s);
  check(' -1');
  i:=655536;
  str(i,s);
  check('655536');
  str(i:0,s);
  check('655536');
  str(i:1,s);
  check('655536');
  str(i:2,s);
  check('655536');
  str(i:3,s);
  check('655536');
  longval:=1;
  i:=int64(longval) shl 33;
  str(i,s);
  check('8589934592');
  str(i:0,s);
  check('8589934592');
  str(i:1,s);
  check('8589934592');
  str(i:2,s);
  check('8589934592');
  str(i:3,s);
  check('8589934592');

  q := 10;
  str(q,s);
  check('10');
  str(q:0,s);
  check('10');
  str(q:1,s);
  check('10');
  str(q:2,s);
  check('10');
  str(q:3,s);
  check(' 10');
  q:=655536;
  str(q,s);
  check('655536');
  str(q:0,s);
  check('655536');
  str(q:1,s);
  check('655536');
  str(q:2,s);
  check('655536');
  str(q:3,s);
  check('655536');
  longval:=1;
  q:=qword(longval) shl 33;
  str(q,s);
  check('8589934592');
  str(q:0,s);
  check('8589934592');
  str(q:1,s);
  check('8589934592');
  str(q:2,s);
  check('8589934592');
  str(q:3,s);
  check('8589934592');
end;

procedure test_ansistr;
type
  tlocalstring = ansistring;
var
  l: longint;
  c: cardinal;
  f: real;
  i: int64;
  q: qword;
  s: tlocalstring;
  len: shortint;
  frac: smallint;
  longval : longint;

  procedure check(const ss: tlocalstring);
  begin
    if s <> ss then
      begin
        writeln('error!');
        halt(1);
      end;
  end;

begin
  writeln('testing str(,ansistring)...');

  l := -1;
  str(l,s);
  check('-1');
  str(l:0,s);
  check('-1');
  str(l:1,s);
  check('-1');
  str(l:2,s);
  check('-1');
  str(l:3,s);
  check(' -1');
  len := 4;
  str(l:len,s);
  check('  -1');

  c := 10;
  str(c,s);
  check('10');
  str(c:0,s);
  check('10');
  str(c:1,s);
  check('10');
  str(c:2,s);
  check('10');
  str(c:3,s);
  check(' 10');

  { for more in-depth tests of str_real, see ../tstreal[1,2].pp }
  f := -1.12345;
{$IFOPT E-}  
  str(f,s);
  if sizeof(extended) = 10 then
    check('-1.123450000000000E+000')
  else if sizeof(extended) = 8 then
    check('-1.12345000000000E+000')
  else
    check('error, not yet implemented!!!!');
{$endif}  
  { the number of exponents depends on the maaping of the real type }
  if sizeof(real) = 8 then
    begin
      str(f:0,s);
      check('-1.1E+000');
      str(f:1,s);
      check('-1.1E+000');
      str(f:2,s);
      check('-1.1E+000');
      str(f:3,s);
      check('-1.1E+000');
      str(f:4,s);
      check('-1.1E+000');
    end
  else
    begin
      str(f:0,s);
      check('-1.1E+00');
      str(f:1,s);
      check('-1.1E+00');
      str(f:2,s);
      check('-1.1E+00');
      str(f:3,s);
      check('-1.1E+00');
      str(f:4,s);
      check('-1.1E+00');
    end;
  str(f:0:0,s);
  check('-1');
  str(f:0:1,s);
  check('-1.1');
  str(f:0:2,s);
  check('-1.12');
  str(f:1:0,s);
  check('-1');
  str(f:1:1,s);
  check('-1.1');
  str(f:5:0,s);
  check('   -1');
  str(f:5:1,s);
  check(' -1.1');
  str(f:5:2,s);
  check('-1.12');
  len := 6;
  frac := 2;
  str(f:len:frac,s);
  check(' -1.12');

  i := -1;
  str(i,s);
  check('-1');
  str(i:0,s);
  check('-1');
  str(i:1,s);
  check('-1');
  str(i:2,s);
  check('-1');
  str(i:3,s);
  check(' -1');
  i:=655536;
  str(i,s);
  check('655536');
  str(i:0,s);
  check('655536');
  str(i:1,s);
  check('655536');
  str(i:2,s);
  check('655536');
  str(i:3,s);
  check('655536');
  longval:=1;
  i:=int64(longval) shl 33;
  str(i,s);
  check('8589934592');
  str(i:0,s);
  check('8589934592');
  str(i:1,s);
  check('8589934592');
  str(i:2,s);
  check('8589934592');
  str(i:3,s);
  check('8589934592');

  q := 10;
  str(q,s);
  check('10');
  str(q:0,s);
  check('10');
  str(q:1,s);
  check('10');
  str(q:2,s);
  check('10');
  str(q:3,s);
  check(' 10');
  q:=655536;
  str(q,s);
  check('655536');
  str(q:0,s);
  check('655536');
  str(q:1,s);
  check('655536');
  str(q:2,s);
  check('655536');
  str(q:3,s);
  check('655536');
  longval:=1;
  q:=qword(longval) shl 33;
  str(q,s);
  check('8589934592');
  str(q:0,s);
  check('8589934592');
  str(q:1,s);
  check('8589934592');
  str(q:2,s);
  check('8589934592');
  str(q:3,s);
  check('8589934592');
end;

{$ifdef haswidestring}
procedure test_widestr;
type
  tlocalstring = widestring;
var
  l: longint;
  c: cardinal;
  f: real;
  i: int64;
  q: qword;
  s: tlocalstring;
  len: longint;
  frac: cardinal;
  longval : longint;

  procedure check(const ss: tlocalstring);
  begin
    if s <> ss then
      begin
        writeln('error!');
        halt(1);
      end;
  end;

begin
  writeln('testing str(,widestring)...');

  l := -1;
  str(l,s);
  check('-1');
  str(l:0,s);
  check('-1');
  str(l:1,s);
  check('-1');
  str(l:2,s);
  check('-1');
  str(l:3,s);
  check(' -1');
  len := 4;
  str(l:len,s);
  check('  -1');

  c := 10;
  str(c,s);
  check('10');
  str(c:0,s);
  check('10');
  str(c:1,s);
  check('10');
  str(c:2,s);
  check('10');
  str(c:3,s);
  check(' 10');

  { for more in-depth tests of str_real, see ../tstreal[1,2].pp }
  f := -1.12345;
{$IFOPT E-}  
  str(f,s);
  if sizeof(extended) = 10 then
    check('-1.123450000000000E+000')
  else if sizeof(extended) = 8 then
    check('-1.12345000000000E+000')
  else
    check('error, not yet implemented!!!!');
{$endif}  
  { the number of exponents depends on the maaping of the real type }
  if sizeof(real) = 8 then
    begin
      str(f:0,s);
      check('-1.1E+000');
      str(f:1,s);
      check('-1.1E+000');
      str(f:2,s);
      check('-1.1E+000');
      str(f:3,s);
      check('-1.1E+000');
      str(f:4,s);
      check('-1.1E+000');
    end
  else
    begin
      str(f:0,s);
      check('-1.1E+00');
      str(f:1,s);
      check('-1.1E+00');
      str(f:2,s);
      check('-1.1E+00');
      str(f:3,s);
      check('-1.1E+00');
      str(f:4,s);
      check('-1.1E+00');
    end;
  str(f:0:0,s);
  check('-1');
  str(f:0:1,s);
  check('-1.1');
  str(f:0:2,s);
  check('-1.12');
  str(f:1:0,s);
  check('-1');
  str(f:1:1,s);
  check('-1.1');
  str(f:5:0,s);
  check('   -1');
  str(f:5:1,s);
  check(' -1.1');
  str(f:5:2,s);
  check('-1.12');
  len := 6;
  frac := 2;
  str(f:len:frac,s);
  check(' -1.12');

  i := -1;
  str(i,s);
  check('-1');
  str(i:0,s);
  check('-1');
  str(i:1,s);
  check('-1');
  str(i:2,s);
  check('-1');
  str(i:3,s);
  check(' -1');
  i:=655536;
  str(i,s);
  check('655536');
  str(i:0,s);
  check('655536');
  str(i:1,s);
  check('655536');
  str(i:2,s);
  check('655536');
  str(i:3,s);
  check('655536');
  longval:=1;
  i:=int64(longval) shl 33;
  str(i,s);
  check('8589934592');
  str(i:0,s);
  check('8589934592');
  str(i:1,s);
  check('8589934592');
  str(i:2,s);
  check('8589934592');
  str(i:3,s);
  check('8589934592');

  q := 10;
  str(q,s);
  check('10');
  str(q:0,s);
  check('10');
  str(q:1,s);
  check('10');
  str(q:2,s);
  check('10');
  str(q:3,s);
  check(' 10');
  q:=655536;
  str(q,s);
  check('655536');
  str(q:0,s);
  check('655536');
  str(q:1,s);
  check('655536');
  str(q:2,s);
  check('655536');
  str(q:3,s);
  check('655536');
  longval:=1;
  q:=qword(longval) shl 33;
  str(q,s);
  check('8589934592');
  str(q:0,s);
  check('8589934592');
  str(q:1,s);
  check('8589934592');
  str(q:2,s);
  check('8589934592');
  str(q:3,s);
  check('8589934592');
end;
{$endif haswidestring}

begin
  test_shortstr;
  test_ansistr;
{$ifdef haswidestring}
  test_widestr;
{$endif haswidestring}
  writeln('str tests successful!');
end.

Link to SVN view of test/cg/tstr.pp source.