function i4row_sorted_search_test ( )

%*****************************************************************************80
%
%% i4row_sorted_search_test tests i4row_sorted_search.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    07 January 2020
%
%  Author:
%
%    John Burkardt
%
  timestamp ( );
  fprintf ( 1, '\n' );
  fprintf ( 1, 'i4row_sorted_search_test:\n' );
  fprintf ( 1, '  Search for an occurrence of a row vector in an array of rows.\n' );

  m = 15;
  n = 3;
  A = randi ( [ 1, 3 ], m, n );

  A = sortrows ( A );

  fprintf ( 1, '\n' );
  fprintf ( 1, '  Row matrix A:\n' );
  fprintf ( 1, '\n' );
  disp ( A );

  fprintf ( 1, '\n' );

  for i = 1 : 5
    r = randi ( [ 1, 3 ], 1, n );
    label = sprintf ( '  Search object #%d', i );
    i4vec_transpose_print ( n, r, label );
    indx = i4row_sorted_search ( A, r );

    if ( indx == -1 )
      fprintf ( 1, '  This object does not occur in A.\n' );
    else
      fprintf ( 1, '  This object occurs in row %d of A\n', indx );
    end

  end
%
%  Terminate.
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'i4row_sorted_search_test:\n' );
  fprintf ( 1, '  Normal end of execution.\n' );
  timestamp ( );

  return
end

