Test suite results for test file test/units/system/tsetstr.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/units/system/tsetstr.pp" information:

t_id 243
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:36:00 24
i386 5 10.0 2024/10/19 08:55:00 60 2024/10/19 11:13:00 63
m68k 3 6.0 2024/10/19 07:29:00 50 2024/10/19 10:22:00 40
sparc 3 6.0 2024/10/19 09:01:00 54 2024/10/19 11:16:00 40
powerpc 5 10.0 2024/10/19 08:40:00 51 2024/10/19 13:26:00 65
arm 2 4.0 2024/10/19 09:36:00 32 2024/10/19 10:03:00 32
x86_64 8 16.0 2024/10/19 08:27:00 30 2024/10/19 13:36:00 24
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 5 10.0 2024/10/19 08:15:00 27 2024/10/19 09:32:00 28
sparc64 4 8.0 2024/10/19 08:33:00 120 2024/10/19 11:33:00 117
riscv64 2 4.0 2024/10/19 10:25:00 33 2024/10/19 11:10:00 26
loongarch64 1 2.0 2024/10/19 10:17:00 30 2024/10/19 10:17:00 30
linux 35 70.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 11:13:00 63
solaris 4 8.0 2024/10/19 13:22:00 24 2024/10/19 13:36:00 24
aix 8 16.0 2024/10/19 08:40:00 51 2024/10/19 13:26:00 65
3.3.1 29 58.0 2024/10/19 08:27:00 30 2024/10/19 13:26:00 65
3.2.3 21 42.0 2024/10/19 07:29:00 50 2024/10/19 13:36:00 24

Source:

{ Program to test system unit setstring routines
  Tested against Delphi 3 and (where possible)
  against Borland Pascal v7.01
  Copyright (c) 2002 Carl Eric Codere
}
program tsetstr;
{$R+}
{$Q+}
{$APPTYPE CONSOLE}

{$ifdef fpc}
  {$ifndef ver1_0}
    {$define haswidestring}
  {$endif}
{$else}
  {$ifndef ver70}
    {$define haswidestring}
  {$endif}
{$endif}
{$ifdef fpc}
  uses strings;
{$else}
  uses SysUtils;
{$endif}
const
  HELLO_STRING = 'Hello my little world!';
  PCHAR_NULL = nil;
  PCHAR_EMPTY : pchar = #0;
  PCHAR_NORMAL : pchar = HELLO_STRING;


var
   arr: array[0..255] of byte;
   str1 : shortstring;
   str2 : ansistring;
{$ifdef haswidestring}
   str3 : widestring;
{$endif}

procedure fail;
 begin
   WriteLn('Failed!');
   Halt(1);
 end;

procedure test_shortstring;
var
 i: longint;
 _failed : boolean;
begin
  _failed := false;
  write('Testing setstring() with shortstring...');
  { buffer : pchar with #0 character }
  {          pchar = nil             }
  {          pchar = valid value     }
  str1:='';
  setstring(str1, PCHAR_NULL, 0);
  if str1 <> '' then
    _failed := true;
  str1:='';
  setstring(str1,PCHAR_EMPTY,strlen(PCHAR_EMPTY));
  if str1 <> '' then
    _failed := true;
  setstring(str1,PCHAR_NORMAL,strlen(PCHAR_NORMAL));
  if str1 <> HELLO_STRING then
    _failed := true;
  { len = 0, len = normal length, len > 255 }
  str1:='';
  setstring(str1, PCHAR_NORMAL, 0);
  if str1 <> '' then
    _failed := true;
  str1:='';
  fillchar(arr,sizeof(arr),'a');
  setstring(str1,@arr[0],512);
  if length(str1) <> 255 then
    _failed := true;
  for i := 1 to length(str1) do
    if str1[i] <> 'a' then
      _failed := true;
  str1:='';  
  setstring(str1,PCHAR_NORMAL,strlen(PCHAR_NORMAL));
  if str1 <> HELLO_STRING then
    _failed := true;
  if _failed then
    fail;
  writeln('Passed!');
end;


procedure test_ansistring;
var
 _failed : boolean;
begin
  _failed := false;
  write('Testing setstring() with ansistring...');
  { buffer : pchar with #0 character }
  {          pchar = nil             }
  {          pchar = valid value     }
  str2:='';
  setstring(str2, PCHAR_NULL, 0);
  if str2 <> '' then
    _failed := true;
  str2:='';
  setstring(str2,PCHAR_EMPTY,strlen(PCHAR_EMPTY));
  if str2 <> '' then
    _failed := true;
  setstring(str2,PCHAR_NORMAL,strlen(PCHAR_NORMAL));
  if str2 <> HELLO_STRING then
    _failed := true;
  { len = 0, len = normal length, len > 255 }
  str2:='';
  setstring(str2, PCHAR_NORMAL, 0);
  if str2 <> '' then
    _failed := true;
  str2:='';
  setstring(str2,PCHAR_NORMAL,strlen(PCHAR_NORMAL));
  if str2 <> HELLO_STRING then
    _failed := true;
  if _failed then
    fail;
  writeln('Passed!');
end;

{$ifdef haswidestring}
procedure test_widestring;
var
 _failed : boolean;
begin
  _failed := false;
  write('Testing setstring() with widestring...');
  { buffer : pchar with #0 character }
  {          pchar = nil             }
  {          pchar = valid value     }
  str3:='';
  setstring(str3, PCHAR_NULL, 0);
  if str3 <> '' then
    _failed := true;
  str3:='';
  setstring(str3,PCHAR_EMPTY,strlen(PCHAR_EMPTY));
  if str3 <> '' then
    _failed := true;
  setstring(str3,PCHAR_NORMAL,strlen(PCHAR_NORMAL));
  if str3 <> HELLO_STRING then
    _failed := true;
  { len = 0, len = normal length, len > 255 }
  str3:='';
  setstring(str3, PCHAR_NORMAL, 0);
  if str3 <> '' then
    _failed := true;
  str3:='';
  setstring(str3,PCHAR_NORMAL,strlen(PCHAR_NORMAL));
  if str3 <> HELLO_STRING then
    _failed := true;
  if _failed then
    fail;
  writeln('Passed!');
end;
{$endif}


Begin
  test_shortstring;
  test_ansistring;
{$ifdef haswidestring}
  test_widestring;
{$endif}
end.

{
  $Log: tsetstr.pp,v $
  Revision 1.3  2003/03/04 18:19:48  jonas
    * adapted tests to fixed implementation

  Revision 1.2  2002/12/16 20:40:36  peter
    * win32 fix

  Revision 1.1  2002/10/20 11:44:15  carl
    + setstring testing
    * args checking is not interactive
    + zero and negative length checking for move/fillchar

}

Link to SVN view of test/units/system/tsetstr.pp source.