function dist_next_test ( )

%*****************************************************************************80
%
%% DIST_NEXT_TEST tests DIST_NEXT.
%
%  Licensing:
%
%    This code is distributed under the GNU LGPL license.
%
%  Modified:
%
%    24 December 2015
%
%  Author:
%
%    John Burkardt
%
  k = 3;
  m = 5;
  q = [];
  leftmost = 0;
  more = 0;

  fprintf ( 1, '\n' );
  fprintf ( 1, 'DIST_NEXT_TEST\n' );
  fprintf ( 1, '  DIST_NEXT produces the "next" distribution of M\n' );
  fprintf ( 1, '  indistinguishable objects among K distinguishable slots:\n' );
  fprintf ( 1, '\n' );
  fprintf ( 1, '  Number of:\n' );
  fprintf ( 1, '    indistinguishable objects = %d\n', m );
  fprintf ( 1, '    distinguishable slots =     %d\n', k );
  fprintf ( 1, '    distributions is            %d\n', dist_enum ( k, m ) );
  fprintf ( 1, '\n' );

  idist = 0;

  while ( 1 )

    [ q, leftmost, more ] = dist_next ( k, m, q, leftmost, more );

    if ( ~more )
      break
    end

    idist = idist + 1;
    fprintf ( 1, '    %5d: ', idist );
    for i = 1 : k
      fprintf ( 1, '%5d', q(i) );
    end
    fprintf ( 1, '\n' );

  end

  return
end
