function comp_rank_grlex_test ( )

%*****************************************************************************80
%
%% comp_rank_grlex_test() tests comp_rank_grlex().
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    01 July 2021
%
%  Author:
%
%    John Burkardt
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'comp_rank_grlex_test():\n' );
  fprintf ( 1, '  comp_rank_grlex() determines the rank of a COMP\n' );
  fprintf ( 1, '  from its parts.\n' ); 
  fprintf ( 1, '  A COMP is a composition of an integer N into K parts.\n' );
  fprintf ( 1, '  Each part is nonnegative.  The order matters.\n' );
  fprintf ( 1, '\n' );
  fprintf ( 1, '        Actual  Inferred\n' );
  fprintf ( 1, '  Test    Rank      Rank\n' );
  fprintf ( 1, '\n' );

  kc = 3;
  rank1 = 20;
  rank2 = 60;

  for test = 1 : 5
    [ xc, rank3 ] = comp_random_grlex ( kc, rank1, rank2 );
    rank4 = comp_rank_grlex ( kc, xc );
    fprintf ( 1, '  %4d  %6d  %8d\n', test, rank3, rank4 ); 
  end

  return
end
