function ubvec_add_test ( )

%*****************************************************************************80
%
%% ubvec_add_test() tests ubvec_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, 'ubvec_add_test()\n' );
  fprintf ( 1, '  ubvec_add() adds unsigned binary vectors representing\n' );
  fprintf ( 1, '  unsigned integers;\n' );
  fprintf ( 1, '\n' );
  fprintf ( 1, '        I        J        K = I + J\n' );
  fprintf ( 1, '\n' );

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

    fprintf ( 1, '\n' );

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

    k = i + j;

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

    bvec1 = ui4_to_ubvec ( i, n );
    bvec2 = ui4_to_ubvec ( j, n );

    bvec3 = ubvec_add ( n, bvec1, bvec2 );
    k = ubvec_to_ui4 ( n, bvec3 );

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

  end

  return
end
