Program TSTCDATE;

{File: [22,311]TSTCDATE.PAS      Last edit: 9-JUN-1987 22:52:55 

 History:  9-Jun-87.  Bob Thomas.   Created.
}

{ Test routine to test CDATE - The Compress date P3UTIL library routine }

%INCLUDE LB:[22,320]GENERAL3.TYP;
%INCLUDE EX:[22,320]SASSIGN.EXT;
%INCLUDE LB:[22,320]CDATE.EXT;

Var
  A_in_date: DEC_date;
  Z_in_date: PACKED ARRAY[0..9]OF char;
  L_in_date: CH20;
  A_out_date: DEC_date;
  Z_out_date: PACKED ARRAY[0..9]OF char;
  L_out_date: CH20;
  resp: char;


Begin
writeln;
writeln('Begin test');
writeln;
A_in_date:='18-Jul-87';
sassign(Z_in_date,A_in_date);
sassign(L_in_date,A_in_date);

{test DEC date strings}
writeln('Testing DEC date strings');
cdate(A_in_date,A_out_date);
writeln('In_date ',A_in_date,'  Out_date ',A_out_date);

{test type zero strings}
writeln('Testing type zero strings');
cdate(Z_in_date,Z_out_date);
sassign(A_in_date,Z_in_date);
sassign(A_out_date,Z_out_date);
writeln('In_date ',A_in_date,'  Out_date ',A_out_date);

{test long strings}
writeln('Testing long strings');
cdate(L_in_date,L_out_date);
writeln('In_date ',L_in_date,'  Out_date ',L_out_date);

{test mixed strings}
writeln('Testing mixed DEC-date/type-zero strings');
sassign(Z_out_date,'         ');
cdate(A_in_date,Z_out_date);
sassign(A_out_date,Z_out_date);
writeln('In_date ',A_in_date,'  Out_date ',A_out_date);

{test DEC date strings}
writeln('Testing mixed long/DEC-date strings');
sassign(A_out_date,'         ');
cdate(A_in_date,A_out_date);
writeln('In_date ',A_in_date,'  Out_date ',A_out_date);

{test Long date strings with other information present}
writeln('Testing long strings with other information present ');
sassign(L_in_date,'15-Jul-87 12:15:00');
sassign(L_out_date,'12345678901234567890');
cdate(L_in_date,L_out_date);
writeln('In_date ',L_in_date,'  Out_date ',L_out_date);

repeat
  write('Enter Test date > ');
  readln(L_in_date);
  writeln;
  cdate(L_in_date,A_out_date);
  writeln('In_date ',L_in_date,'  Out_date ',A_out_date);
  writeln;
  write('Loop again (Y,N)> ');
  readln(resp);
  until (resp <> 'Y') and (resp <> 'y');
writeln;
writeln('End test');
writeln;
end.


