function ksubset_colex_successor_test ( )

%*****************************************************************************80
%
%% KSUBSET_COLEX_SUCCESSOR_TEST tests KSUBSET_COLEX_SUCCESSOR.
%
%  Licensing:
%
%    This code is distributed under the GNU LGPL 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 ( 1 );

    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
