function xy2d_test ( )

%*****************************************************************************80
%
%% xy2d_test() tests xy2d().
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    02 January 2016
%
%  Author:
%
%    John Burkardt
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'xy2d_test():\n' );
  fprintf ( 1, '  xy2d() converts an (X,Y) 2D coordinate to a Hilbert linear D coordinate.\n' );

  m = 3;
  n = 2 ^ m;

  fprintf ( 1, '\n' );
  fprintf ( 1, '        ' );
  for x = 0 : n - 1
    fprintf ( 1, '%3d', x );
  end
  fprintf ( 1, '\n' );

  fprintf ( 1, '\n' );
  for y = n - 1 : -1 : 0
    fprintf ( 1, '  %3d:  ', y );
    for x = 0 : n - 1
      d = xy2d ( m, x, y );
      fprintf ( 1, '%3d', d );
    end
    fprintf ( 1, '\n' );
  end

  return
end
