function i4vec_is_permutation_test ( )

%*****************************************************************************80
%
%% i4vec_is_permutation_test() tests i4vec_is_permutation().
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    24 February 2021
%
%  Author:
%
%    John Burkardt
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'i4vec_is_permutation_test():\n' );
  fprintf ( 1, '  i4vec_is_permutation() is TRUE if an I4VEC represents\n' );
  fprintf ( 1, '  a permutation.\n' );

  fprintf ( 1, '\n' );
  fprintf ( 1, '  Example 1: Obvious:\n' );
  a = [ 1, 2, 3 ];
  a
  if ( i4vec_is_permutation ( a ) )
    fprintf ( 1, '  A is a permutation.\n' );
  else
    fprintf ( 1, '  A is NOT a permutation.\n' );
  end

  fprintf ( 1, '\n' );
  fprintf ( 1, '  Example 2: Obviously NOT:\n' );
  a = [ 4; 5; 6.5 ];
  a
  if ( i4vec_is_permutation ( a ) )
    fprintf ( 1, '  A is a permutation.\n' );
  else
    fprintf ( 1, '  A is NOT a permutation.\n' );
  end

  fprintf ( 1, '\n' );
  fprintf ( 1, '  Example 3: Something is missing:\n' );
  a = [ 1, 8, 6, 3, 4, 2, 7 ];
  a
  if ( i4vec_is_permutation ( a ) )
    fprintf ( 1, '  A is a permutation.\n' );
  else
    fprintf ( 1, '  A is NOT a permutation.\n' );
  end

  fprintf ( 1, '\n' );
  fprintf ( 1, '  Example 4: Must be 1-based, not 0!:\n' );
  a = [ 2, 0, 1 ];
  a
  if ( i4vec_is_permutation ( a ) )
    fprintf ( 1, '  A is a permutation.\n' );
  else
    fprintf ( 1, '  A is NOT a permutation.\n' );
  end

  fprintf ( 1, '\n' );
  fprintf ( 1, '  Example 5: An array is OK:\n' );
  a = [ 3, 6, 2;
        5, 1, 4 ];
  a
  if ( i4vec_is_permutation ( a ) )
    fprintf ( 1, '  A is a permutation.\n' );
  else
    fprintf ( 1, '  A is NOT a permutation.\n' );
  end

  return
end
