function i4row_sorted_insert_test ( )

%*****************************************************************************80
%
%% i4row_sorted_insert_test tests i4row_sorted_insert.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    05 January 2020
%
%  Author:
%
%    John Burkardt
%
  timestamp ( );
  fprintf ( 1, '\n' );
  fprintf ( 1, 'i4row_sorted_insert_test:\n' );
  fprintf ( 1, '  Insert rows into a sorted array of rows.\n' );

  m = 5;
  n = 3;
  A = randi ( [ 0, 10 ], m, n );

  A = sortrows ( A );

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

  fprintf ( 1, '\n' );

  for i = 1 : 5
    r = randi ( [ 0, 10 ], 1, n );
    label = sprintf ( '  New row #%d', i );
    i4vec_transpose_print ( n, r, label );
    A = i4row_sorted_insert ( A, r );
    fprintf ( 1, '\n' );
    fprintf ( 1, '  Updated matrix A:\n' );
    fprintf ( 1, '\n' );
    disp ( A );
  end
%
%  Terminate.
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'i4row_sorted_insert_test:\n' );
  fprintf ( 1, '  Normal end of execution.\n' );
  timestamp ( );

  return
end

