function ksub_to_comp_test ( )

%*****************************************************************************80
%
%% ksub_to_comp_test() tests ksub_to_comp().
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    11 June 2020
%
%  Author:
%
%    John Burkardt
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'ksub_to_comp_test():\n' );
  fprintf ( 1, '  ksub_to_comp() returns the composition corresponding to a K subset.\n' );

  nc = 10;
  kc = 5;

  for i = 1 : 5

    fprintf ( 1, '\n' );

    ac = comp_random ( nc, kc );
    fprintf ( '  COMP:' );
    for j = 1 : kc
      fprintf ( 1, '  %2d', ac(j) );
    end
    fprintf ( 1, '\n' );

    [ ns, ks, as ] = comp_to_ksub ( nc, kc, ac );
    fprintf ( '  KSUB:' );
    for j = 1 : ks
      fprintf ( 1, '  %2d', as(j) );
    end
    fprintf ( 1, '\n' );

    [ nc, kc, ac ] = ksub_to_comp ( ns, ks, as );
    fprintf ( '  COMP:' );
    for j = 1 : kc
      fprintf ( 1, '  %2d', ac(j) );
    end
    fprintf ( 1, '\n' );
    
  end

  return
end
