function ksubset_colex_successor_test ( )

%*****************************************************************************80
%
%% ksubset_colex_successor_test() tests ksubset_colex_successor().
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    22 December 2015
%
%  Author:
%
%    John Burkardt
%
  k = 3;
  n = 5;

  fprintf ( 1, ' \n' );
  fprintf ( 1, 'ksubset_colex_successor_test():\n' );
  fprintf ( 1, '  ksubset_colex_successor() lists K-subsets of an N set,\n' );
  fprintf ( 1, '  using the colexicographic ordering.\n' );

  t = [];
  rank = -1;

  while ( true );

    rank_old = rank;

    [ t, rank ] = ksubset_colex_successor ( k, n, t, rank );

    if ( rank <= rank_old )
      break
    end

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

  end

  return
end
