function candy_count_box_test ( )

%*****************************************************************************80
%
%% candy_count_box_test() tests candy_count_box().
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    22 June 2024
%
%  Author:
%
%    John Burkardt
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'candy_count_box_test():\n' );
  fprintf ( 1, '  candy_count_box() counts candy types in a 3D box.\n' );
  fprintf ( 1, '  There are LxMxN entries in the box 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,K) = mod ( i + j + k - 3, c ) + 1\n' );
  fprintf ( 1, '  Count the number of candies of each type.\n' );
%
%  Test 1
%
  c = 4;
  l = 7;
  m = 10;
  n = 13;
  fprintf ( 1, '\n' );
  fprintf ( 1, '  Count using candy_count_box()\n' );
  fprintf ( 1, '\n' );
  fprintf ( 1, '   C   L   M   N  ' );
  for i = 1 : c
    fprintf ( 1, '   #%d', i );
  end
  fprintf ( 1, '\n' );
  counts = candy_count_box ( c, l, m, n );
  fprintf ( 1, '  %2d  %2d  %2d  %2d: ', c, l, m, n );
  for i = 1 : c
    fprintf ( 1, '  %3d', counts(i) );
  end
  fprintf ( 1, '\n' );

  c = 4;
  l = 7;
  m = 10;
  n = 13;
  fprintf ( 1, '\n' );
  fprintf ( 1, '  Repeat calculation using candy_count_box_sum()\n' );
  fprintf ( 1, '\n' );
  fprintf ( 1, '   C   L   M   N  ' );
  for i = 1 : c
    fprintf ( 1, '   #%d', i );
  end
  fprintf ( 1, '\n' );
  counts = candy_count_box_sum ( c, l, m, n );
  fprintf ( 1, '  %2d  %2d  %2d  %2d: ', c, l, m, n );
  for i = 1 : c
    fprintf ( 1, '  %3d', counts(i) );
  end
  fprintf ( 1, '\n' );
%
%  Test 2
%
  c = 5;
  l = 12;
  m = 13;
  n = 19;
  fprintf ( 1, '\n' );
  fprintf ( 1, '  Count using candy_count_box()\n' );
  fprintf ( 1, '\n' );
  fprintf ( 1, '   C   L   M   N  ' );
  for i = 1 : c
    fprintf ( 1, '   #%d', i );
  end
  fprintf ( 1, '\n' );
  counts = candy_count_box ( c, l, m, n );
  fprintf ( 1, '  %2d  %2d  %2d  %2d: ', c, l, m, n );
  for i = 1 : c
    fprintf ( 1, '  %3d', counts(i) );
  end
  fprintf ( 1, '\n' );

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

  return
end
