function components_1d_test ( )

%*****************************************************************************80
%
%% components_1d_test() tests components_1d().
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    17 July 2022
%
%  Author:
%
%    John Burkardt
%
  n = 28;

  A = [ ...
    0, 0, 1, 2, 4, 0, 0, 4, 0, 0, ...
    0, 8, 9, 9, 1, 2, 3, 0, 0, 5, ...
    0, 1, 6, 0, 0, 0, 4, 0 ];

  fprintf ( 1, '\n' );
  fprintf ( 1, 'components_1d_test():\n' );
  fprintf ( 1, '  components_1d() finds and labels connected\n' );
  fprintf ( 1, '  components in a 1D integer vector.\n' );

  fprintf ( 1, '\n' );
  fprintf ( 1, '  A:\n' );
  fprintf ( 1, '\n' );
  fprintf ( 1, '    ' );
  for i = 1 : n
    fprintf ( 1, '%d', A(i) );
  end
  fprintf ( 1, '\n' );

  C = components_1d ( A );
  component_num = max ( C );
  fprintf ( 1, '\n' );
  fprintf ( 1, '  Number of components = %d\n', component_num );
  fprintf ( 1, '\n' );
  fprintf ( 1, '  C:\n' );
  fprintf ( 1, '\n' );
  fprintf ( 1, '    ' );
  for i = 1 : n
    fprintf ( 1, '%d', C(i) );
  end
  fprintf ( 1, '\n' );

  return
end
