Program TSTCNDTAD;

{File: [22,311]TSTCNDTAD.PAS      Last edit: 9-JUN-1987 15:14:55 

 History:  26-May-87.  Philip Hannay.  Created
	    9-Jun-87.  Bob Thomas.     Expanded to test conformant arrays 
}

{ Test routine to test CNDTAD Convert Numeric Date to Ascii Date
  P3UTIL library routine }

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

Var
  I_date: int_date;
  A_date: DEC_date;
  Z_date: PACKED ARRAY[0..9]OF char;
  L_date: CH20;
  resp: char;

Begin
writeln;
writeln('Begin test');
writeln;
I_date.year:=87;
I_date.month:=7;
I_date.day:=18;

{test type zero string}
writeln('Testing type zero string');
cndtad(I_date,z_date);
if z_date[1]=chr(0) then writeln('FAILURE - Type zero string test');
if z_date[1]<>chr(0) then begin
	sassign(a_date,z_date);
	writeln('Numeric date ',i_date.year,':',i_date.month,':'
	,i_date.day,'  Ascii date  ',A_date);
end;{if}

{test long string}
writeln('Testing long string');
cndtad(I_date,L_date);
if L_date[1]=chr(0) then writeln('FAILURE - Type long string test');
if L_date[1]<>chr(0) then begin
	writeln('Numeric date ',i_date.year,':',i_date.month,':'
	,i_date.day,'  Ascii date  ',A_date);
end;{if}



repeat
  writeln;
  write('Enter year> ');
  readln(I_date.year);
  write('Enter month> ');
  readln(I_date.month);
  write('Enter day> ');
  readln(I_date.day);
  writeln;
  writeln('Integer date is "',I_date.month:2,':',I_date.day:2,':'
       ,I_date.year:2,'" (DD:MM:YY).');
  writeln('Convert to ascii date....');
  writeln;
  cndtad(I_date,A_date);
  writeln('Ascii DEC sytle date is "',A_date,'" (DD-MMM-YY).');
  writeln;
  write('Loop again (Y,N)> ');
  readln(resp);
  until (resp <> 'Y') and (resp <> 'y');
writeln;
writeln('End test');
writeln;
end.


