function subset_by_size_next_test ( )

%*****************************************************************************80
%
%% subset_by_size_next_test() tests subset_by_size_next().
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    09 June 2015
%
%  Author:
%
%    John Burkardt
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'subset_by_size_next_test():\n' );
  fprintf ( 1, '  subset_by_size_next() generates all subsets of an N set.\n' );
  fprintf ( 1, '\n' );

  n = 5;
  a = zeros ( n, 1 );
  subsize = 0;
  more = 0;
  more2 = 0;
  m = 0;
  m2 = 0;

  rank = 0;

  while ( true )

    [ a, subsize, more, more2, m, m2 ] = subset_by_size_next ( n, a, ...
      subsize, more, more2, m, m2 );

    rank = rank + 1;
    fprintf ( 1, '  %2d', rank );

    if ( 0 < subsize )
      for i = 1 : subsize
        fprintf ( 1, '  %2d', a(i) );
      end
      fprintf ( 1, '\n' );
    else
      fprintf ( 1, '  The empty set\n' );
    end

    if ( ~more )
      break
    end

  end

  return
end
