home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / pascal.zip / TESTFILE.PAS < prev   
Pascal/Delphi Source File  |  1994-04-29  |  2KB  |  62 lines

  1. program Testing;
  2.  
  3. var
  4. first, second, third;
  5.  
  6. const
  7. fourth=4;
  8. fifth=5;
  9.  
  10. begin
  11.  
  12.     write( 'Testing ODD function' );
  13.     if odd( 1 ) then
  14.     write( 'OK' );
  15.     if odd( 2 ) then
  16.     write( 'ODD ERROR' );
  17.     write;
  18.  
  19.     write( 'Testing WHILE function (5 loops)' );
  20.     first := 0;
  21.     while first < fifth do
  22.         begin
  23.             first := first + 1;
  24.             write( ( fifth - first ), ' loops left...' );
  25.         end;
  26.  
  27.     write;
  28.  
  29.     write( 'Testing variable assignment' );
  30.     write( 'Please enter a value:' );
  31.     read( first );
  32.     second := first;
  33.     write( 'The value you entered is ', second );
  34.     write;
  35.  
  36.     write( 'Testing arithmatic functions' );
  37.  
  38.     write( ' - additions and subtractions' );
  39.     first := ( 2 + 2 ) - 4;
  40.     if first <> 0 then write( '   first set ERROR (', first, ')' );
  41.         if first = 0 then write( '   first set ok' );
  42.     first := 2 + ( 2 - 4 );
  43.     if first <> 0 then write( '   second set ERROR (', first, ')' );
  44.     if first = 0 then write( '   second set ok' );
  45.  
  46.     write( ' - multiplication and division' );
  47.     first := ( 2 * 4 ) / 2;
  48.     if first <> 4 then write( '   first set ERROR (', first, ')' );
  49.     if first = 4 then write( '   first set ok' );
  50.     first := 2 * ( 4 / 2 );
  51.     if first <> 4 then write( '   second set ERROR (', first, ')' );
  52.     if first = 4 then write( '   second set ok' );
  53.  
  54.     write( ' - all four operators' );
  55.     first := 2 + 2 * 2 - 4 / 2;
  56.     if first <> 4 then write( '   first set ERROR (', first, ')' );
  57.     if first = 4 then write( '   first set ok' );
  58.     first := ( 2 + 2 ) * 2 - 4 / 2;
  59.     if first <> 6 then write( '   second set ERROR (', first, ')' );
  60.     if first = 6 then write( '   second set ok' );
  61. end.
  62.