tpi.pp 696 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. { this tests the pi routine, as an inline }
  2. program tpi;
  3. const
  4. PI_CONST = 3.1459;
  5. { the following expression also works on constants }
  6. PI_CONST_VALUE = pi;
  7. procedure fail;
  8. begin
  9. WriteLn('Failed!');
  10. halt(1);
  11. end;
  12. var
  13. value : real;
  14. _result : boolean;
  15. Begin
  16. Write('Pi() test...');
  17. _result := true;
  18. value:=pi;
  19. if trunc(value) <> trunc(PI_CONST) then
  20. _result := false;
  21. If trunc(Pi) <> trunc(PI_CONST) then
  22. _result := false;
  23. If trunc(Pi) <> trunc(PI_CONST_VALUE) then
  24. _result := false;
  25. if not _result then
  26. fail;
  27. WriteLn('Success!');
  28. end.
  29. {
  30. $Log$
  31. Revision 1.1 2002-09-16 19:15:54 carl
  32. * several new routines have a testsuit.
  33. }