function perm0_lex_next_test ( )

%*****************************************************************************80
%
%% PERM0_LEX_NEXT_TEST tests PERM0_LEX_NEXT.
%
%  Licensing:
%
%    This code is distributed under the GNU LGPL 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
