Test suite results for test file webtbs/tw2178.pp

Test run data :

Run ID:
Operating system: linux
Processor: powerpc
Version: 3.2.3
Fails/OK/Total: 47/7936/7983
Version: 3.2.3
Full version: 3.2.3-1374-g849fbd722c-unpushed
Comment: -gwl -O4 -Xd -Fl/usr/lib32 -Fd -Fl/usr/lib/gcc/powerpc64-linux-gnu/13/32 -Fd
Machine: gcc203
Category: 1
SVN revisions: fdf93c5b29:849fbd722c:ae0fe8a6a0:d1c29e6cb9
Submitter: pierre
Date: 2024/04/19 11:24:00 <> 2024/04/10
Previous run: 933768
Next run: 936200

Hide skipped tests

Hide successful tests

Test file "webtbs/tw2178.pp" information:

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

Detailed test run results:

tr_idruntr_oktr_skiptr_result
443750224934978TrueFalseSuccessfully run

Record count: 1

No log of 934978.

Source:

type
stlpos=^stlink;
stlink=
  packed object
   next,prev:stlpos;
   data:string;
   procedure save(var f:file);
   procedure load(var f:file);
  end;
list_of_string=
  packed object
   parent:pointer;
   anchor:stlpos;
   last:stlpos;
   len:longint;
   constructor init(p:pointer);
   function first:stlpos;
   function next(p:stlpos):stlpos;
   function prev(p:stlpos):stlpos;
   function ret(p:stlpos):string;
   function pret(p:stlpos):pointer;
   function insert(p:stlpos;d:string):stlpos;
   function remove(p:stlpos):stlpos;
   function empty:boolean;
   destructor term;
   procedure save(var f:file);
   procedure load(var f:file);
  end;

stack_of_string=
  packed object (list_of_string)
   procedure pop(var s:string);
   procedure push(const s:string);
  end;

procedure writestring(var f:file;s:string);
begin
  blockwrite(f,s,length(s)+1);
end;

procedure readstring(var f:file;var s:string);
var b:byte;
begin
  blockread(f,b,1);
  seek(f,filepos(f)-1);
  blockread(f,s,b+1);
end;

constructor list_of_string.init(p:pointer);
begin
  parent:=p;
  new(anchor);
  anchor^.next:=nil;
  anchor^.prev:=nil;
  last:=anchor;
  len:=0;
end;

function list_of_string.first:stlpos;
begin
  first:=anchor^.next;
end;

function list_of_string.next(p:stlpos):stlpos;
begin
  next:=p^.next;
end;

function list_of_string.prev(p:stlpos):stlpos;
begin
  prev:=p^.prev;
end;

function list_of_string.ret(p:stlpos):string;
begin
  ret:=p^.data;
end;

function list_of_string.pret(p:stlpos):pointer;
begin
  pret:=@(p^.data);
end;

function list_of_string.insert(p:stlpos;d:string):stlpos;
var t:stlpos;
begin
  new(t);
  t^.prev:=p;
  t^.next:=p^.next;
  p^.next:=t;
  if t^.next<>nil then
   t^.next^.prev:=t
  else
   last:=t;
  t^.data:=d;
  inc(len);
  insert:=t;
end;

function list_of_string.remove(p:stlpos):stlpos;
begin
  if p^.prev<>nil then
   p^.prev^.next:=p^.next;
  if p^.next<>nil then
   p^.next^.prev:=p^.prev
  else
   last:=p^.prev;
  dispose(p);
  dec(len);
  remove:=p^.next;
end;

function list_of_string.empty:boolean;
begin
  empty:=(last=anchor);
end;

destructor list_of_string.term;
begin
  while not empty do
   remove(last);
  dispose(anchor);
  last:=nil;
end;

procedure stlink.save(var f:file);
begin
  writestring(f,data);
end;

procedure list_of_string.save(var f:file);
var
  l,i:longint;
  p:stlpos;
begin
  l:=len;
  blockwrite(f,l,sizeof(longint));
  p:=first;
  for i:=1 to l do
   begin
    p^.save(f);
    p:=next(p);
   end;
end;

procedure stlink.load(var f:file);
begin
  readstring(f,data);
end;

procedure list_of_string.load(var f:file);
var
  l,i:longint;
  d:stlink;
begin
  blockread(f,l,sizeof(longint));
  for i:=1 to l do
   begin
    d.load(f);
    insert(last,d.data);
   end;
end;

procedure stack_of_string.pop(var s:string);
begin
  if not empty then
   begin
    s:=first^.data;
    remove(first);
   end;
end;

procedure stack_of_string.push(const s:string);
begin
  insert(anchor,s);
end;

var
  gs:stack_of_string;
  opaddr : ^string;
begin
  gs.init(nil);
  gs.push('test');

  {perfectly compiles}
  opaddr:=@((gs.first)^.data);
  writeln(opaddr^);
  if (opaddr^<>'test') then
   halt(1);

  {reports error ") expected ^ but found"}
  opaddr:=@(gs.first^.data);
  writeln(opaddr^);
  if (opaddr^<>'test') then
   halt(1);


end.

Link to SVN view of webtbs/tw2178.pp source.