Program TSTADATIM;

{ Version
  File:[22,310]TSTADATIM.PAS
  Last edit: 6-SEP-1989 14:12:43 
  Author: Jim Bostwick 2-Nov-83
  History:
    
     6-Sep-89.  Philip Hannay.  Updated for enhanced ADATIM.

Testing P3UTIL module(s): ADATIM

}

{$nolist}
{[a+,b+,l-,k+,r+] Pasmat }
%INCLUDE pas$ext:general.typ;
%INCLUDE pas$ext:adatim.ext;
%include pas$ext:string.pkg;

{$list}

Var
  fill1: ch2;
  timeonly: DEC_time;
  fill2: ch2;
  dateonly: DEC_date;
  fill3: char;
  fulldateonly: Full_date;
  fill4: char;
  DECstamp: DEC_timestamp;
  fill5: ch2;
  Fullstamp: Full_timestamp;
  fill6: ch2;
  Fullstamptenths: Full_timestamp_tenths;  
  fill7: ch2;
  badstamp: ch12;
  sfill1: ch2;
  stimeonly: str8;
  sfill2: char;
  sdateonly: str9;
  sfill3: ch2;
  sfulldateonly: str11;
  sfill4: ch2;
  sDECstamp: str18;
  sfill5: char;
  sFullstamp: str20;
  sfill6: char;
  sFullstamptenths: str22;
  sfill7: char;
  sbadstamp: str12;
  sfill8: char;
  

BEGIN
  Writeln('adatim test');
  adatim(fullstamp);
  writeln('at the tone, the time will be: ',fullstamp,'.',chr(7));
  writeln;
  writeln('Now exercise all time options...');
  writeln;
  writeln('First the CHxx arrays');
  { blank all fill vars to see sure they are later corrupted by overflow
    or underflow }
  fill1:= '  ';
  fill2:= '  ';
  fill3:= ' ';
  fill4:= ' ';
  fill5:= '  ';
  fill6:= '  ';
  fill7:= '  ';
  sfill1:= '  ';
  sfill2:= ' ';
  sfill3:= '  ';
  sfill4:= '  ';
  sfill5:= ' ';
  sfill6:= ' ';
  sfill7:= ' ';
  sfill8:= ' ';
  { now try all combos }
  writeln;
  adatim(timeonly);
  writeln('result is "',timeonly,'", should be HH:MM:SS');
  adatim(dateonly);
  writeln('result is "',dateonly,'", should be DD-Mmm-YY');
  adatim(fulldateonly);
  writeln('result is "',fulldateonly,'", should be DD-Mmm-YYYY');
  adatim(DECstamp);
  writeln('result is "',DECstamp,'", should be DD-Mmm-YY HH:MM:SS');
  adatim(Fullstamp);
  writeln('result is "',Fullstamp,'", should be DD-Mmm-YYYY HH:MM:SS');
  adatim(Fullstamptenths);
  writeln('result is "',Fullstamptenths,'", should be DD-Mmm-YYYY HH:MM:SS.S');
  writeln;
  writeln('and using an illegal size of CH12');
  badstamp:= 'NO SUCH LUCK';
  adatim(badstamp);
  writeln('result is "',badstamp,'", should be NO SUCH LUCK');
  writeln;
  writeln('verify that no overflow or underflow occurred');
  if fill1 <> '  ' then writeln('over/under flow in fill1');
  if fill2 <> '  ' then writeln('over/under flow in fill2');
  if fill3 <> ' ' then writeln('over/under flow in fill3');
  if fill4 <> ' ' then writeln('over/under flow in fill4');
  if fill5 <> '  ' then writeln('over/under flow in fill5');
  if fill6 <> '  ' then writeln('over/under flow in fill6');
  if fill7 <> '  ' then writeln('over/under flow in fill7');
  if sfill1 <> '  ' then writeln('over/under flow in sfill1');
  if sfill2 <> ' ' then writeln('over/under flow in sfill2');
  if sfill3 <> '  ' then writeln('over/under flow in sfill3');
  if sfill4 <> '  ' then writeln('over/under flow in sfill4');
  if sfill5 <> ' ' then writeln('over/under flow in sfill5');
  if sfill6 <> ' ' then writeln('over/under flow in sfill6');
  if sfill7 <> ' ' then writeln('over/under flow in sfill7');
  if sfill8 <> ' ' then writeln('over/under flow in sfill8');
  writeln;
  writeln('if no messages, no over/under flow occurrred');
  writeln;
  writeln;
  writeln('Then the STRxx arrays');
  { blank all fill vars to see sure they are later corrupted by overflow
    or underflow }
  fill1:= '  ';
  fill2:= '  ';
  fill3:= ' ';
  fill4:= ' ';
  fill5:= '  ';
  fill6:= '  ';
  fill7:= '  ';
  sfill1:= '  ';
  sfill2:= ' ';
  sfill3:= '  ';
  sfill4:= '  ';
  sfill5:= ' ';
  sfill6:= ' ';
  sfill7:= ' ';
  sfill8:= ' ';
  { now try all combos }
  writeln;
  adatim(stimeonly);
  write('result is "');
  swrite(output,stimeonly);
  writeln('", should be HH:MM:SS');
  adatim(sdateonly);
  write('result is "');
  swrite(output,sdateonly);
  writeln('", should be DD-Mmm-YY');
  adatim(sfulldateonly);
  write('result is "');
  swrite(output,sfulldateonly);
  writeln('", should be DD-Mmm-YYYY');
  adatim(sDECstamp);
  write('result is "');
  swrite(output,sDECstamp);
  writeln('", should be DD-Mmm-YY HH:MM:SS');
  adatim(sFullstamp);
  write('result is "');
  swrite(output,sFullstamp);
  writeln('", should be DD-Mmm-YYYY HH:MM:SS');
  adatim(sFullstamptenths);
  write('result is "');
  swrite(output,sFullstamptenths);
  writeln('", should be DD-Mmm-YYYY HH:MM:SS.S');
  writeln;
  writeln('and using an illegal size of STR12');
  sassign(sbadstamp,'NO SUCH LUCK');
  adatim(sbadstamp);
  write('result is "');
  swrite(output,sbadstamp);
  writeln('", should be NO SUCH LUCK');
  writeln;
  writeln('verify that no overflow or underflow occurred');
  if fill1 <> '  ' then writeln('over/under flow in fill1');
  if fill2 <> '  ' then writeln('over/under flow in fill2');
  if fill3 <> ' ' then writeln('over/under flow in fill3');
  if fill4 <> ' ' then writeln('over/under flow in fill4');
  if fill5 <> '  ' then writeln('over/under flow in fill5');
  if fill6 <> '  ' then writeln('over/under flow in fill6');
  if fill7 <> '  ' then writeln('over/under flow in fill7');
  if sfill1 <> '  ' then writeln('over/under flow in sfill1');
  if sfill2 <> ' ' then writeln('over/under flow in sfill2');
  if sfill3 <> '  ' then writeln('over/under flow in sfill3');
  if sfill4 <> '  ' then writeln('over/under flow in sfill4');
  if sfill5 <> ' ' then writeln('over/under flow in sfill5');
  if sfill6 <> ' ' then writeln('over/under flow in sfill6');
  if sfill7 <> ' ' then writeln('over/under flow in sfill7');
  if sfill8 <> ' ' then writeln('over/under flow in sfill8');
  writeln;
  writeln('if no messages, no over/under flow occurrred');
  writeln;
  writeln;
  writeln('end of test.')
end.  
