function toms112_test ( )

%*****************************************************************************80
%
%% toms112_test() tests toms112().
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    01 March 2019
%
%  Author:
%
%    John Burkardt
%
  addpath ( '../toms112' );

  timestamp ( );
  fprintf ( 1, '\n' );
  fprintf ( 1, 'toms112_test():\n' );
  fprintf ( 1, '  MATLAB/Octave version %s\n', version ( ) );
  fprintf ( 1, '  toms112() determines if a point is in a polygon.\n' );

  n = 5;
  x = [ 0.0; 1.0; 2.0; 1.0; 0.0 ];
  y = [ 0.0; 0.0; 1.0; 2.0; 2.0 ];

  r8vec2_print ( n, x, y, '  The polygon vertices:' )

  fprintf ( 1, '\n' );
  fprintf ( 1, '      Px      Py  Inside\n' );
  fprintf ( 1, '\n' );

  test_num = 4;
  x0_test = [ 1.0, 3.0, 0.0, 0.5 ];
  y0_test = [ 1.0, 4.0, 2.0, -0.25 ];

  for test = 1 : test_num
 
    x0 = x0_test(test);
    y0 = y0_test(test);

    inside = point_in_polygon ( n, x, y, x0, y0 );

    fprintf ( 1, '  %6.2g  %6.2g       %d\n', x0, y0, inside );

  end
%
%  Terminate.
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'toms112_test():\n' );
  fprintf ( 1, '  Normal end of execution.\n' );
  fprintf ( 1, '\n' );
  timestamp ( );

  rmpath ( '../toms112' );

  return
end
function timestamp ( )

%*****************************************************************************80
%
%% timestamp() prints the current YMDHMS date as a timestamp.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    14 February 2003
%
%  Author:
%
%    John Burkardt
%
  t = now;
  c = datevec ( t );
  s = datestr ( c, 0 );
  fprintf ( 1, '%s\n', s );

  return
end

