function ui4_rank_gray_test ( )

%*****************************************************************************80
%
%% UI4_RANK_GRAY_TEST tests UI4_RANK_GRAY.
%
%  Licensing:
%
%    This code is distributed under the GNU LGPL license. 
%
%  Modified:
%
%    19 November 2015
%
%  Author:
%
%    John Burkardt
%
  n = 5;

  fprintf ( 1, '\n' );
  fprintf ( 1, 'UI4_RANK_GRAY_TEST\n' );
  fprintf ( 1, '  UI4_RANK_GRAY ranks a UI4 in the Gray ordering.\n' );
  fprintf ( 1, '\n' );
  fprintf ( 1, ' UI4  Rank  (binary)\n' );
  fprintf ( 1, '\n' );
 
  for ui4 = 0 : 31
    rank = ui4_rank_gray ( ui4 );
    ubvec = ui4_to_ubvec ( ui4, n );
    fprintf ( 1, '  %2d    %2d  ', ui4, rank );
    for j = 1 : n
      fprintf ( 1, '%2d', ubvec(j) );
    end
    fprintf ( 1, '\n' );
  end

  return
end

