function i4_partition_next_test ( )

%*****************************************************************************80
%
%% i4_partition_next_test() tests i4_partition_next().
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    14 February 2003
%
%  Author:
%
%    John Burkardt
%
  n = 7;

  fprintf ( 1, '\n' );
  fprintf ( 1, 'i4_partition_next_test():\n' );
  fprintf ( 1, '  i4_partition_next() generates partitions of an integer.\n' );
  fprintf ( 1, '  Here N = %d\n', n );
  fprintf ( 1, '\n' );

  rank = 0;
  done = 1;
  npart = 0;
  a = [];
  mult = [];
  
  while ( true )

    [ npart, a, mult, done ] = i4_partition_next ( n, npart, a, mult, done );
 
    if ( done )
      break 
    end

    rank = rank + 1;

    i4_partition_print ( n, npart, a, mult );

  end

  return
end
