function circle_distance_test ( )

%*****************************************************************************80
%
%% CIRCLE_DISTANCE_TEST tests the CIRCLE_DISTANCE library.
%
%  Licensing:
%
%    This code is distributed under the GNU LGPL license.
%
%  Modified:
%
%    17 April 2019
%
%  Author:
%
%    John Burkardt
%
  addpath ( '../circle_distance' );

  timestamp ( );
  fprintf ( 1, '\n' );
  fprintf ( 1, 'CIRCLE_DISTANCE_TEST:\n' );
  fprintf ( 1, '  MATLAB version\n' );
  fprintf ( 1, '  Test the CIRCLE_DISTANCE library.\n' );

  n = 10000;
  [ mu, var ] = circle_distance_stats ( n );
  mu_exact = 4.0 / pi;
  fprintf ( 1, '\n' );
  fprintf ( 1, '  Using N = %d sample points,\n', n );
  fprintf ( 1, '  Estimated mean distance = %g\n', mu );
  fprintf ( 1, '  Exact mean distance     = %g\n', mu_exact );
  fprintf ( 1, '  Estimated variance      = %g\n', var );

  n = 10000;
  circle_distance_histogram ( n );
  filename = 'circle_distance_histogram.png';
  print ( '-dpng', filename );
  fprintf ( 1, '\n' );
  fprintf ( 1, '  Graphics saved in "%s"\n', filename );
  pause ( 5 );

  circle_distance_pdf ( );
  filename = 'circle_distance_pdf.png';
  print ( '-dpng', filename );
  fprintf ( 1, '\n' );
  fprintf ( 1, '  Graphics saved in "%s"\n', filename );
  pause ( 5 );

  clf
  hold on
  n = 10000;
  circle_distance_histogram ( n );
  circle_distance_pdf ( );
  hold off
  filename = 'circle_distance_compare.png';
  print ( '-dpng', filename );
  fprintf ( 1, '\n' );
  fprintf ( 1, '  Graphics saved in "%s"\n', filename );
  pause ( 5 );
%
%  Terminate.
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'CIRCLE_DISTANCE_TEST:\n' );
  fprintf ( 1, '  Normal end of execution.\n' );
  fprintf ( 1, '\n' );
  timestamp ( );

  rmpath ( '../circle_distance' );

  return
end

