function npart_rsf_lex_successor_test ( )

%*****************************************************************************80
%
%% NPART_RSF_LEX_SUCCESSOR_TEST tests NPART_RSF_LEX_SUCCESSOR.
%
%  Licensing:
%
%    This code is distributed under the GNU LGPL license.
%
%  Modified:
%
%    22 December 2015
%
%  Author:
%
%    John Burkardt
%
  npart = 3;
  n = 12;

  fprintf ( 1, ' \n' );
  fprintf ( 1, 'NPART_RSF_LEX_SUCCESSOR_TEST\n' );
  fprintf ( 1, '  NPART_RSF_LEX_SUCCESSOR lists\n' );
  fprintf ( 1, '  partitions of N with NPART parts\n' );
  fprintf ( 1, '  in reverse standard form.\n' );

  t = [];
  rank = -1;

  while ( 1 )

    rank_old = rank;

    [ t, rank ] = npart_rsf_lex_successor ( n, npart, t, rank );

    if ( rank <= rank_old )
      break
    end

    fprintf ( 1, '  %4d  ', rank );
    for i = 1 : npart
      fprintf ( 1, '%5d', t(i) );
    end
    fprintf ( 1, '\n' );

  end

  return
end
