function ccff_test ( )

%*****************************************************************************80
%
%% ccff_test() uses ccff() for 1D quadrature over [-1,1].
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    19 May 2014
%
%  Author:
%
%    John Burkardt
%

%
%  Get the exact result.
%
  d = 1;
  exact = legendre_integral ( d );

  fprintf ( 1, '\n' );
  fprintf ( 1, 'ccff_test():\n' );
  fprintf ( 1, '  ccff() performs Boyd''s CCFF quadrature over [0,1]:\n' );
  fprintf ( 1, '  Exact integral is %16.8g\n', exact );
  fprintf ( 1, '\n' );
  fprintf ( 1, '   Level   Nodes         Estimate    Error\n' );
  fprintf ( 1, '\n' );

  for l = 1 : 5

    n = ccff_order ( l );

    [ x, w ] = ccff ( n );

    fx = legendre_integrand ( d, n, x );
 
    q = w' * fx;
    e = sqrt ( ( q - exact ).^2 ) / exact;

    fprintf( '  %2d     %6d  %16.8g  %6.2e\n', l, n, q, e )

  end

  return
end
