function perm1_lex_next_test ( )

%*****************************************************************************80
%
%% PERM1_LEX_NEXT_TEST tests PERM1_LEX_NEXT.
%
%  Licensing:
%
%    This code is distributed under the GNU LGPL license.
%
%  Modified:
%
%    14 February 2003
%
%  Author:
%
%    John Burkardt
%
  n = 4;

  fprintf ( 1, '\n' );
  fprintf ( 1, 'PERM1_LEX_NEXT_TEST\n' );
  fprintf ( 1, '  PERM1_LEX_NEXT generates permutations of (1,...,N).\n' );
  fprintf ( 1, '\n' );
  
  p = [];
  more = 0;
 
  while ( true )

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

    if ( ~more )
      break
    end

    perm1_print ( n, p, '' );

  end

  return
end
