function dvec_add_test ( )

%*****************************************************************************80
%
%% dvec_add_test() tests dvec_add().
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    01 July 2021
%
%  Author:
%
%    John Burkardt
%
  n = 10;
  test_num = 10;

  fprintf ( 1, '\n' );
  fprintf ( 1, 'dvec_add_test()\n' );
  fprintf ( 1, '  dvec_add() adds decimal vectors representing integers;\n' );
  fprintf ( 1, '\n' );
  fprintf ( 1, '        I        J        K = I + J\n' );
  fprintf ( 1, '\n' );

  for test = 1 : test_num
    
    i = randi ( [ -100, 100 ], 1 );
    j = randi ( [ -100, 100 ], 1 );

    fprintf ( 1, '\n' );

    fprintf ( 1, '  %8d  %8d\n', i, j );

    k = i + j;

    fprintf ( 1, '  Directly:           %8d  %8d\n', k );

    dvec1 = i4_to_dvec ( i, n );
    dvec2 = i4_to_dvec ( j, n );

    dvec3 = dvec_add ( n, dvec1, dvec2 );
    k = dvec_to_i4 ( n, dvec3 );

    fprintf ( 1, '  DVEC_ADD  %8d\n', k );

  end

  return
end
