function subset_next_test ( )

%*****************************************************************************80
%
%% subset_next_test() tests subset_next().
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    25 November 2024
%
%  Author:
%
%    John Burkardt
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'subset_next_test():\n' );
  fprintf ( 1, '  Test subset_next()\n' );
  fprintf ( 1, '\n' );

  n = 5;
  fprintf ( 1, '  Generate in order subsets of size %d\n', n );
  fprintf ( 1, '\n' );

  s = zeros ( n, 1 );
  i = -1;
  while ( true )
    i = i + 1;
    fprintf ( 1, '  %2d:', i );
    for j = 1 : n
      fprintf ( 1, '  %d', s(j) );
    end
    fprintf ( 1, '\n' );
    s = subset_next ( s );
    if ( sum ( s ) == 0 )
      break;
    end
  end

  return
end

