function multiperm_next_test ( )

%*****************************************************************************80
%
%% multiperm_next_test() tests multiperm_next().
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    14 February 2003
%
%  Author:
%
%    John Burkardt
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'multiperm_next_test():\n' );
  fprintf ( 1, '  multiperm_next() computes multipermutations in\n' );
  fprintf ( 1, '  lexical order.\n' );
  fprintf ( 1, '\n' );

  tally = 0;
  a = [ 1, 2, 2, 3, 3, 3 ];
  n = 6;
  more = 1;
  
  while ( more )
      
    tally = tally + 1;
    
    fprintf ( 1, '  %4d    ', tally );
    for i = 1 : n
      fprintf ( 1, '  %2d', a(i) );
    end
    fprintf ( 1, '\n' );

    [ a, more ] = multiperm_next ( n, a );
            
  end
  
  return
end
