function mono_next_grlex_test ( )

%*****************************************************************************80
%
%% mono_next_grlex_test() tests mono_next_grlex().
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    08 December 2013
%
%  Author:
%
%    John Burkardt
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'mono_next_grlex_test\n' );
  fprintf ( 1, '  MONO_NEXT_GRLEX computes the next monomial\n' );
  fprintf ( 1, '  in M variables, in graded lexicographic order.\n' );

  m = 4;

  fprintf ( 1, '\n' );
  fprintf ( 1, '  Let M =  %d\n', m );

  a = 0;
  b = 3;

  for i = 1 : 10

    x = randi ( [ 0, 3 ], m );

    fprintf ( 1, '\n' );
    for j = 1 : m
      fprintf ( 1, '  %1d', x(j) );
    end
    fprintf ( 1, '\n' );

    for j = 1 : 5
      x = mono_next_grlex ( m, x );
      for j = 1 : m
        fprintf ( 1, '  %1d', x(j) );
      end
      fprintf ( 1, '\n' );
    end

  end

  return
end
