function subcompnz2_next_test ( )

%*****************************************************************************80
%
%% subcompnz2_next_test() tests subcompnz2_next().
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    06 June 2015
%
%  Author:
%
%    John Burkardt
%
  n_lo = 5;
  n_hi = 7;
  k = 3;
  a = [];
  more = 0;
  h = 0;
  t = 0;
  n2 = 0;
  more2 = 0;

  fprintf ( 1, '\n' );
  fprintf ( 1, 'subcompnz2_next_test():\n' );
  fprintf ( 1, '  subcompnz2_next() generates subcompositions\n' );
  fprintf ( 1, '  using nonzero parts.\n' );
  fprintf ( 1, '\n' );
  fprintf ( 1, '  Seek all subcompositions of N\n');
  fprintf ( 1, '  using K = %d nonzero parts\n', k );
  fprintf ( 1, '  for %d <= N <= %d\n', n_lo, n_hi );
  fprintf ( 1, '\n' );
  fprintf ( 1, '     #     N\n' );
  fprintf ( 1, '\n' );

  rank = 0;

  while ( true )

    [ a, more, h, t, n2, more2 ] = subcompnz2_next ( n_lo, n_hi, k, a, more, ...
      h, t, n2, more2 );

    rank = rank + 1;
    n = sum ( a(1:k) );
    fprintf ( 1, '  %4d  %4d  ', rank, n );
    for i = 1 : k
      fprintf ( 1, '%4d', a(i) );
    end
    fprintf ( 1, '\n' );

    if ( ~more )
      break
    end

  end

  return
end
