function example_test ( a, b, f, title )

%*****************************************************************************80
%
%% example_test() tests zero_rc() on one test function.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    29 May 2021
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    real A, B, the endpoints of the change of sign interval.
%
%    function value = F ( x ), the name of a user-supplied
%    function which evaluates the function whose zero is being sought.
%
%    string TITLE, a title for the problem.
%
  fprintf ( 1, '\n' );
  fprintf ( 1, '  %s\n', title );
  fprintf ( 1, '\n' );
  fprintf ( 1, '    STATUS      X               F(X)\n' );
  fprintf ( 1, '\n' );
 
  t = eps;
  value = [];
  status = 0;

  while ( true )

    [ arg, status ] = zero_rc ( a, b, t, value, status );

    if ( status < 0 )
      fprintf ( 1, '\n' );
      fprintf ( 1, '  zero_rc() returned an error flag!\n' );
      error ( 'zero_rc() returned an error flag!' );
    end

    value = f(arg);

    fprintf ( 1, '  %8d  %24.16g  %14g\n', status, arg, value );

    if ( status == 0 )
      break
    end

  end

  return
end
