function setpart_to_rgf_test ( )

%*****************************************************************************80
%
%% setpart_to_rgf_test() tests setpart_to_rgf().
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    23 December 2015
%
%  Author:
%
%    John Burkardt
%
  m = 8;

  fprintf ( 1, ' \n' );
  fprintf ( 1, 'setpart_to_rgf_test():\n' );
  fprintf ( 1, '  setpart_to_rgf() converts a set partition\n' );
  fprintf ( 1, '  to a restricted growth function.\n' );

  nsub = 3;
  s = [ 1, 2, 3, 4, 5, 6, 7, 8 ];
  index = [ 6, 7, 8 ];

  fprintf ( 1, ' \n' );
  fprintf ( 1, '  The set partition\n' );
  fprintf ( 1, ' \n' );
  jlo = 1;
  for i = 1 : nsub
    for j = jlo : index(i)
      fprintf ( 1, '%4d', s(j) );
    end
    fprintf ( 1, '\n');
    jlo = index(i) + 1;
  end
%
%  Convert the set partition back to an RGF.
%
  f = setpart_to_rgf ( m, nsub, s, index );

  i4vec_print ( m, f,  '  Recovered restricted growth function:' );

  return
end
