function subset_sum_table_test ( t, n, w )

%*****************************************************************************80
%
%% subset_sum_table_test() tests subset_sum_table().
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    09 November 2015
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    integer T, the target value.
%
%    integer N, the number of weights.
%
%    integer W(N), a set of weights.
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'subset_sum_table_test():\n' );
  fprintf ( 1, '  subset_sum_table() seeks a subset of W that sums to T.\n' );
  fprintf ( 1, '\n' );
  fprintf ( 1, '  Target value T = %d\n', t );
  fprintf ( 1, '\n' );
  fprintf ( 1, '   I       W(I)\n' );
  fprintf ( 1, '\n' );
  for i = 1 : n
    fprintf ( 1, '  %2d  %8d\n', i, w(i) );
  end

  table = subset_sum_table ( t, n, w );

  fprintf ( 1, '\n' );

  if ( isempty ( table ) )
    fprintf ( 1, '  No solution was found.\n' );
  else
    list = subset_sum_table_to_list ( t, table );
    m = length ( list );
    fprintf ( 1, '  %d = ', t )
    for i = 1 : m
      if ( 1 < i ) 
        fprintf ( 1, ' + ' );
      end
      fprintf ( 1, '%d', list(i) )
    end
    fprintf ( 1, '\n' );
  end

  return
end
