function task_division_test ( )

%*****************************************************************************80
%
%% task_division_test() tests task_division().
%
%  Discussion:
%
%    This program simply demonstrates how one might automate the
%    assignment of T tasks to P processors, assuming that the assignment
%    is to be beforehand.
%
%    In that case, we just want to make sure that we assign each task
%    to a processor, that we assign about the same number of tasks
%    to each processor, and that we assign each processor a contiguous
%    range of tasks, say tasks I_LO to I_HI.
%
%    The routine that is called simulates this process.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    27 March 2019
%
%  Author:
%
%    John Burkardt
%
  addpath ( '../task_division' );

  timestamp ( );
  fprintf ( 1, '\n' );
  fprintf ( 1, 'task_division_test():\n' );
  fprintf ( 1, '  MATLAB/Octave version %s\n', version ( ) );
  fprintf ( 1, '  task_division() automates the division of\n' );
  fprintf ( 1, '  T tasks among a range of P processors\n' );
  fprintf ( 1, '  indexed from PROC_FIRST to PROC_LAST.\n' );

  task_number = 23;
  proc_first = 0;
  proc_last = 3;
  task_division ( task_number, proc_first, proc_last );

  task_number = 17;
  proc_first = 1;
  proc_last = 6;
  task_division ( task_number, proc_first, proc_last );

  task_number = 17;
  proc_first = 4;
  proc_last = 6;
  task_division ( task_number, proc_first, proc_last );

  task_number = 5;
  proc_first = -2;
  proc_last = 6;
  task_division ( task_number, proc_first, proc_last );

  task_number = 5;
  proc_first = 0;
  proc_last = 4;
  task_division ( task_number, proc_first, proc_last );

  task_number = 5;
  proc_first = 0;
  proc_last = 0;
  task_division ( task_number, proc_first, proc_last );

  task_number = 1000;
  proc_first = 1;
  proc_last = 17;
  task_division ( task_number, proc_first, proc_last );
%
%  Terminate.
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'task_division_test():\n' );
  fprintf ( 1, '  Normal end of execution.\n' );
  fprintf ( 1, '\n' );
  timestamp ( );

  rmpath ( '../task_division' );

  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

