function candy_count_matrix_test ( )

%*****************************************************************************80
%
%% candy_count_matrix_test() tests candy_count_matrix().
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    22 June 2024
%
%  Author:
%
%    John Burkardt
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'candy_count_matrix_test():\n' );
  fprintf ( 1, '  candy_count_matrix() counts candy types in a matrix.\n' );
  fprintf ( 1, '  There are MxN entries in the matrix A().\n' );
  fprintf ( 1, '  There are C candy types.\n' );
  fprintf ( 1, '  Candy types are assigned cyclically to matrix entries:\n' );
  fprintf ( 1, '  A(I,J) = mod ( i + j - 2, c ) + 1\n' );
  fprintf ( 1, '  Count the number of candies of each type.\n' );
%
%  Test 1
%
  c = 4;
  m = 10;
  n = 13;
  fprintf ( 1, '\n' );
  fprintf ( 1, '  Count using candy_count_matrix()\n' );
  fprintf ( 1, '\n' );
  fprintf ( 1, '   C   M   N  ' );
  for i = 1 : c
    fprintf ( 1, '  #%d', i );
  end
  fprintf ( 1, '\n' );
  counts = candy_count_matrix ( c, m, n );
  fprintf ( 1, '  %2d  %2d  %2d: ', c, m, n );
  for i = 1 : c
    fprintf ( 1, '  %2d', counts(i) );
  end
  fprintf ( 1, '\n' );

  c = 4;
  m = 10;
  n = 13;
  fprintf ( 1, '\n' );
  fprintf ( 1, '  Repeat calculation using candy_count_matrix_sum()\n' );
  fprintf ( 1, '\n' );
  fprintf ( 1, '   C   M   N  ' );
  for i = 1 : c
    fprintf ( 1, '  #%d', i );
  end
  fprintf ( 1, '\n' );
  counts = candy_count_matrix_sum ( c, m, n );
  fprintf ( 1, '  %2d  %2d  %2d: ', c, m, n );
  for i = 1 : c
    fprintf ( 1, '  %2d', counts(i) );
  end
  fprintf ( 1, '\n' );
%
%  Test 2
%
  c = 5;
  m = 13;
  n = 19;
  fprintf ( 1, '\n' );
  fprintf ( 1, '  Count using candy_count_matrix()\n' );
  fprintf ( 1, '\n' );
  fprintf ( 1, '   C   M   N  ' );
  for i = 1 : c
    fprintf ( 1, '  #%d', i );
  end
  fprintf ( 1, '\n' );
  counts = candy_count_matrix ( c, m, n );
  fprintf ( 1, '  %2d  %2d  %2d: ', c, m, n );
  for i = 1 : c
    fprintf ( 1, '  %2d', counts(i) );
  end
  fprintf ( 1, '\n' );

  c = 5;
  m = 13;
  n = 19;
  fprintf ( 1, '\n' );
  fprintf ( 1, '  Repeat calculation using candy_count_matrix_sum()\n' );
  fprintf ( 1, '\n' );
  fprintf ( 1, '   C   M   N  ' );
  for i = 1 : c
    fprintf ( 1, '  #%d', i );
  end
  fprintf ( 1, '\n' );
  counts = candy_count_matrix_sum ( c, m, n );
  fprintf ( 1, '  %2d  %2d  %2d: ', c, m, n );
  for i = 1 : c
    fprintf ( 1, '  %2d', counts(i) );
  end
  fprintf ( 1, '\n' );
  return
end
