function perm0_lex_next_test ( )

%*****************************************************************************80
%
%% perm0_lex_next_test() tests perm0_lex_next().
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    30 May 2015
%
%  Author:
%
%    John Burkardt
%
  n = 4;

  fprintf ( 1, '\n' );
  fprintf ( 1, 'perm0_lex_next_test():\n' );
  fprintf ( 1, '  perm0_lex_next() generates permutations of (0,...,N-1).\n' );
  fprintf ( 1, '\n' );
  
  p = [];
  more = 0;
 
  while ( true )

    [ p, more ] = perm0_lex_next ( n, p, more );

    if ( ~more )
      break
    end

    perm0_print ( n, p, ' ' );

  end

  return
end
