function bal_seq_rank_test ( )

%*****************************************************************************80
%
%% bal_seq_rank_test() tests bal_seq_rank().
%
%  Licensing:
%
%    This code is distributed under the MIT 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
