function bal_seq_rank_test ( )

%*****************************************************************************80
%
%% BAL_SEQ_RANK_TEST tests BAL_SEQ_RANK.
%
%  Licensing:
%
%    This code is distributed under the GNU LGPL license.
%
%  Modified:
%
%    25 November 2015
%
%  Author:
%
%    John Burkardt
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'BAL_SEQ_RANK_TEST\n' );
  fprintf ( 1, '  BAL_SEQ_RANK ranks balanced sequences of N items.\n' );

  n = 5;
  t = [ 0, 0, 1, 0, 1, 1, 0, 0, 1, 1 ];
  rank = bal_seq_rank ( n, t );

  fprintf ( 1, '\n' );
  fprintf ( 1, '  The element to be ranked is:\n' );
  fprintf ( 1, '\n' );
  for i = 1 : 2 * n
    fprintf ( 1, '%2d', t(i) );
  end
  fprintf ( 1, '\n' );

  fprintf ( 1, '\n' );
  fprintf ( 1, '  Computed rank: %d\n', rank );

  return
end
