function index_next1_test ( )

%*****************************************************************************80
%
%% index_next1_test() tests index_next1().
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    14 February 2003
%
%  Author:
%
%    John Burkardt
%
  n = 3;
  hi = [ 4, 2, 3 ];

  fprintf ( 1, '\n' );
  fprintf ( 1, 'index_next1_test():\n' );
  fprintf ( 1, '  index_next1() generates all indices of an\n' );
  fprintf ( 1, '  array of given shape, with\n' );
  fprintf ( 1, '  lower limit 1 and given upper limits.\n' );
  fprintf ( 1, '\n' );
  fprintf ( 1, '  Number of index entries = %d\n', n );

  i4vec_print ( n, hi, '  Coordinate maximum indices:' );
 
  fprintf ( 1, '\n' );
  fprintf ( 1, '  Index arrays:' );
  fprintf ( 1, '\n' );

  a = [];
  more = 0;

  while ( true )

    [ a, more ] = index_next1 ( n, hi, a, more );

    for i = 1 : n
      fprintf ( 1, '  %2d', a(i) );
    end
    fprintf ( 1, '\n' );

    if ( ~more )
      break
    end

  end

  return
end
