function polyomino_periodicity_apply_test ( )

%*****************************************************************************80
%
%% POLYOMINO_PERIODICITY_APPLY_TEST tests POLYOMINO_PERIODICITY_APPLY.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    11 December 2018
%
%  Author:
%
%    John Burkardt
%
  timestamp ( );
  fprintf ( 1, '\n' );
  fprintf ( 1, 'POLYOMINO_PERIODICITY_APPLY_TEST:\n' );
  fprintf ( 1, '  MATLAB/Octave version %s\n', version ( ) );
  fprintf ( 1, '  Test polyomino_periodicity_apply\n' );
  fprintf ( 1, '\n' );
  fprintf ( 1, '  POLYOMINO_PERIODICITY_APPLY applies periodicity to a polyomino P\n' );
  fprintf ( 1, '  with respect to a region R.\n' );
%
%  Set the region R.
%
  r = [ ...
    1, 1, 1; ...
    1, 1, 1; ...
    1, 1, 1; ...
    1, 1, 1];

  [ r_m, r_n ] = size ( r );
  label = '  Region R to be tiled:';
  polyomino_print ( r_m, r_n, r, label );
%
%  Set the polyomino P.
%
  p = [ ...
    0, 0, 0, 0, 0; ...
    0, 0, 0, 0, 0; ...
    0, 0, 1, 0, 0; ...
    0, 1, 1, 1, 0; ...
    0, 0, 1, 0, 0];

  [ p_m, p_n ] = size ( p );
  label = '  Polyomino P:';
  polyomino_print ( p_m, p_n, p, label );

  d = ( 5 );
%
%  Get T.
%
  t = polyomino_periodicity_apply ( r_m, r_n, r, p_m, p_n, p );
%
%  Print T.
%
  [ t_m, t_n ] = size ( t );
  label = '  Periodicized polyomino T:';
  polyomino_print ( t_m, t_n, t, label );
%
%  Terminate.
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'POLYOMINO_PERIODICITY_APPLY_TEST\n' );
  fprintf ( 1, '  Normal end of execution.\n' );
  timestamp ( );

  return
end

