function tree_successor_test ( )

%*****************************************************************************80
%
%% tree_successor_test() tests tree_successor().
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    22 December 2015
%
%  Author:
%
%    John Burkardt
%
  n = 4;

  fprintf ( 1, ' \n' );
  fprintf ( 1, 'tree_successor_test():\n' );
  fprintf ( 1, '  tree_successor() lists trees.\n' );

  t = [];
  rank = -1;

  while ( true );

    rank_old = rank;

    [ t, rank ] = tree_successor ( n, t, rank );

    if ( rank <= rank_old )
      break
    end

    fprintf ( 1, '%5d  ', rank );
    for j = 1 : n - 1
      fprintf ( 1, '%5d', t(1,j) );
    end
    fprintf ( 1, '\n' );
    fprintf ( 1, '       ' );
    for j = 1 : n - 1
      fprintf ( 1, '%5d', t(2,j) );
    end
    fprintf ( 1, '\n' );

  end

  return
end
