function perm_is_unicycle_test ( )

%*****************************************************************************80
%
%% perm_is_unicycle_test() tests perm_is_unicycle().
%
%  Licensing:
%
%    This code is distributed under the MIT license. 
%
%  Modified:
%
%    13 June 2012
%
%  Author:
%
%    John Burkardt
%
  n = 5;
  test_num = 10;

  fprintf ( 1, '\n' );
  fprintf ( 1, 'perm_is_unicycle_test():\n' );
  fprintf ( 1, '  perm_is_unicycle() determines whether a permutation\n' );
  fprintf ( 1, '  is a unicyle\n' );

  for test = 1 : test_num

    p = perm_random ( n );

    value = perm_is_unicycle ( n, p );

    if ( value )

      perm_print ( n, p, '  This permutation is a unicycle' );
      u = unicycle_index_to_sequence ( n, p );
      unicycle_print ( n, u, '  The permutation in sequence form' );

    else

      perm_print ( n, p, '  This permutation is NOT a unicycle' );

    end

  end

  return
end
