function mollatz_test ( )

%*****************************************************************************80
%
%% mollatz_test() tests mollatz().
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    12 June 2022
%
%  Author:
%
%    John Burkardt
%
  test_num = 5;
  key_test = [ 5, 6, 19, 27, 95 ];

  fprintf ( 1, '\n' );
  fprintf ( 1, 'mollatz_test()\n' );
  fprintf ( 1, '  mollatz() computes the mollatz sequence for a given key.\n' );

  for test = 1 : test_num

    key = key_test(test);

    s = mollatz ( key );
    n = length ( s );

    fprintf ( 1, '\n' );
    fprintf ( 1, '  key: %d\n', key );
    fprintf ( 1, '  Sequence length: %d\n', n );
    fprintf ( 1, '\n' );

    for i = 1 : 10 : n
      for j = i : min ( i + 9, n )
        fprintf ( 1, '  %8d', s(j) );
      end
      fprintf ( 1, '\n' );
    end

  end

  return
end
