function i4mat_u_solve_test ( )

%*****************************************************************************80
%
%% I4MAT_U_SOLVE_TEST tests I4MAT_U_SOLVE.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    28 July 2015
%
%  Author:
%
%    John Burkardt
%
  n = 4;

  a = [ ...
    1,  2,  4,  7; ...
    0,  3,  5,  8; ...
    0,  0,  6,  9; ...
    0,  0,  0, 10 ];
  b = [ 45; 53; 54; 40 ];

  fprintf ( 1, '\n' );
  fprintf ( 1, 'I4MAT_U_SOLVE_TEST\n' );
  fprintf ( 1, '  I4MAT_U_SOLVE solves an upper triangular system\n' );
  fprintf ( 1, '  A*x=b, where A and b contain only integer values.\n' );

  i4mat_print ( n, n, a, '  Input matrix A:' );

  i4vec_print ( n, b, '  Right hand side b:' );

  x = i4mat_u_solve ( n, a, b );

  if ( r8vec_is_integer ( n, x ) )
    i4vec_print ( n, x, '  Integer solution x:' );
  else
    r8vec_print ( n, x, '  Real solution x:' );
  end

  r = a * x - b;

  rnorm = norm ( r );

  fprintf ( 1, '\n' );
  fprintf ( 1, '  Norm of A*x-b = %g\n', rnorm );

  return
end
