function pruefer_successor_test ( )

%*****************************************************************************80
%
%% PRUEFER_SUCCESSOR_TEST tests PRUEFER_SUCCESSOR.
%
%  Licensing:
%
%    This code is distributed under the GNU LGPL license.
%
%  Modified:
%
%    23 December 2015
%
%  Author:
%
%    John Burkardt
%
  n = 4;

  fprintf ( 1, ' \n' );
  fprintf ( 1, 'PRUEFER_SUCCESSOR_TEST\n' );
  fprintf ( 1, '  PRUEFER_SUCCESSOR lists Pruefer codes.\n' );

  p = [];
  rank = -1;

  while ( 1 );

    rank_old = rank;

    [ p, rank ] = pruefer_successor ( n, p, rank );

    if ( rank <= rank_old )
      break
    end

    fprintf ( 1, '  %3d  ', rank );
    for i = 1 : n - 2
      fprintf ( 1, '%5d', p(i) );
    end
    fprintf ( 1, '\n' );

  end

  return
end
