function ui4_unrank_gray_test ( )

%*****************************************************************************80
%
%% ui4_unrank_gray_test() tests ui4_unrank_gray().
%
%  Licensing:
%
%    This code is distributed under the MIT license. 
%
%  Modified:
%
%    19 November 2015
%
%  Author:
%
%    John Burkardt
%
  n = 5;

  fprintf ( 1, '\n' );
  fprintf ( 1, 'ui4_unrank_gray_test():\n' );
  fprintf ( 1, '  ui4_unrank_gray() unranks a Gray code.\n' );
  fprintf ( 1, '\n' );
  fprintf ( 1, '  Rank   I  (binary)\n' );
  fprintf ( 1, '\n' );
 
  for rank = 0 : 31
    ui4 = ui4_unrank_gray ( rank );
    ubvec = ui4_to_ubvec ( ui4, n );
    fprintf ( 1, '  %2d    %2d  ', rank, ui4 );
    for j = 1 : n
      fprintf ( 1, '%2d', ubvec(j) );
    end
    fprintf ( 1, '\n' );
  end

  return
end
