function nearest_interp_1d_test01 ( prob, ni )

%*****************************************************************************80
%
%% nearest_interp_1d_test01() tests nearest_interp_1d().
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    29 August 2012
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    integer PROB, the index of the problem.
%
%    integer NI, the number of interpolation points.
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'nearest_interp_1d_test01():\n' );
  fprintf ( 1, '  Sample the nearest neighbor interpolant for problem #%d\n', prob );

  nd = p00_data_num ( prob );
  d = p00_data ( prob, 2, nd );
  xd = d(1,:)';
  yd = d(2,:)';
  xd_min = min ( xd );
  xd_max = max ( xd );

  xi = r8vec_linspace ( ni, xd_min, xd_max );
  yi = nearest_interp_1d ( nd, xd, yd, ni, xi );

  title = sprintf ( 'X, Y for problem %d', prob );
  r8vec2_print ( xi, yi, title );

  return
end
