function tp_to_xyz_test ( )

%*****************************************************************************80
%
%% tp_to_xyz_test() tests tp_to_xyz().
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    31 July 2018
%
%  Author:
%
%    John Burkardt
%
  ntest = 6;

  fprintf ( 1, '\n' );
  fprintf ( 1, 'tp_to_xyz_test():\n' );
  fprintf ( 1, '  tp_to_xyz() converts (Theta,Phi) to normalized XYZ coordinates.\n' );
  fprintf ( 1, '  xyz_to_tp() converts XYZ to (Theta,Phi) coordinates.\n' );

  fprintf ( 1, '\n' );
  fprintf ( 1, '     T     P     X    Y     Z     T     P\n' );
  fprintf ( 1, '\n' );

  for i = 1 : ntest
    t = pi * rand ( 1, 1 );
    p = pi * rand ( 1, 1 );

    xyz = tp_to_xyz ( t, p );

    [ t2, p2 ] = xyz_to_tp ( xyz );

    fprintf ( 1, '  %8.4f  %8.4f  %8.4f  %8.4f  %8.4f  %8.4f  %8.4f\n', ...
      t, p, xyz(1:3), t2, p2 );

  end

  return
end
