function npart_rsf_lex_successor_test ( )

%*****************************************************************************80
%
%% npart_rsf_lex_successor_test() tests npart_rsf_lex_successor().
%
%  Licensing:
%
%    This code is distributed under the MIT 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 ( true )

    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
