function hamming84_h_test ( )

%*****************************************************************************80
%
%% hamming84_h_test() tests hamming74_h().
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    03 July 2018
%
%  Author:
%
%    John Burkardt
%
  r = 3;
  n = 2^r;
  k = 2^r - r - 1;

  fprintf ( 1, '\n' );
  fprintf ( 1, 'hamming84_h_test():\n' );
  fprintf ( 1, '  hamming84_h() returns the Hamming H74 parity-check matrix.\n' );
  fprintf ( 1, '\n' );
  fprintf ( 1, '  Exponent R = %d\n', r );
  fprintf ( 1, '  Block length N = 2^R = %d\n', n );
  fprintf ( 1, '  Message length K = 2^R - R - 1 = %d.\n', k );

  h84 = hamming84_h ( );
  g84 = hamming84_g ( );

  fprintf ( 1, '\n' );
  fprintf ( 1, '  Test #1: mod ( H * G, 2 ) = 0?\n' );
  fprintf ( 1, '\n' );

  hg = h84 * g84;
  hg = mod ( hg, 2 );

  fprintf ( 1, '  | mod ( H * G, 2 ) | = %g\n', norm ( hg, 'fro' ) );

  fprintf ( 1, '\n' );
  fprintf ( 1, '  Test #2: Only codewords with 0 parity are Messages\n' );
  fprintf ( 1, '\n' );

  fprintf ( 1, '\n' );
  fprintf ( 1, '    I   Codeword(I)           Parity\n' );
  fprintf ( 1, '\n' );

  i_max = 2^n - 1;

  for i = 0 : i_max
    y = ui4_to_ubvec ( i, n );
    p = h84 * y;
    p = mod ( p, 2 );
    fprintf ( 1, '  %3d: (%d %d %d %d %d %d %d %d) --> (%d %d %d %d)\n', ...
      i, y(1:n), p(1:k) )
  end

  return
end

