function perm1_next_test ( )

%*****************************************************************************80
%
%% perm1_next_test() tests perm1_next().
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    13 June 2015
%
%  Author:
%
%    John Burkardt
%
  n = 4;

  fprintf ( 1, '\n' );
  fprintf ( 1, 'perm1_next_test():\n' );
  fprintf ( 1, '  perm1_next() generates permutations of (1,...,N).\n' );
  fprintf ( 1, '\n' );

  more = 0;
  p = zeros ( n, 1 );
  even = [];
 
  while ( true )

    [ p, more, even ] = perm1_next ( n, p, more, even );

    perm1_print ( n, p, '' );

    if ( ~more )
      break
    end
 
  end

  return
end
