Program SWriteTST;

{ File: [22,311]SWRITETST.PAS     Last edit: 15-APR-1988 16:56:54 
}

{ Test routine for SWRITE.  SASSIGN and SCLEAR are used and so they
must be working first.  }

%INCLUDE EX:[22,320]GENERAL3.TYP;
%include ex:[22,320]string.pkg;

TYPE
  String = packed array [0..30] of char;

VAR
  fill1: ch10;
  buf1: string;
  fill2: ch10;
  buf2: ch30;
  fill3: ch10;
  buf3: packed array [2..30] of char;
  fill4: ch10;
  i: integer;

Begin
Writeln('Begin SWRITE test');
writeln;
fill1:= 'TEST*TEST*';
fill2:= 'TEST*TEST*';
fill3:= 'TEST*TEST*';
fill4:= 'TEST*TEST*';
for i:=2 to 30 do buf3[i]:= 'X';

sclear(buf1);
writeln('First we write out an empty type 0 string');
write('Empty string = "');
swrite(output,buf1);
writeln('"');
writeln;

sassign(buf1,'PARTIAL STRING');
writeln('Next we write out an partial type 0 string');
write('Partial string = "');
swrite(output,buf1);
writeln('"');
writeln;

sassign(buf1,'FULL STRING WITH 30 CHR THEEND');
writeln('And we write a full type 0 string');
write('Full string = "');
swrite(output,buf1);
writeln('"');
writeln;

sclear(buf2);
writeln('First we write out an empty type 0 string');
write('Empty string = "');
swrite(output,buf2);
writeln('"');
writeln;

sassign(buf2,'PARTIAL STRING');
writeln('Next we write out an partial type 0 string');
write('Partial string = "');
swrite(output,buf2);
writeln('"');
writeln;

sassign(buf2,'FULL STRING WITH 30 CHR THEEND');
writeln('And we write a full type 0 string');
write('Full string = "');
swrite(output,buf2);
writeln('"');
writeln;

writeln('Finally we write an invalid (non-type0,type1) string');
write('Bad string = "');
swrite(output,buf3);
writeln('"');
writeln;

writeln;
writeln('End of test');
writeln;
end.
