function levenshtein_distance_test ( )

%*****************************************************************************80
%
%% levenshtein_distance_test() tests levenshtein_distance().
%
%  Licensing:
%
%    This code is distributed under the MIT license. 
%
%  Modified:
%
%    11 September 2022
%
%  Author:
%
%    John Burkardt
%
  addpath ( '../levenshtein_distance' );

  timestamp ( );
  fprintf ( 1, '\n' );
  fprintf ( 1, 'levenshtein_distance_test():\n' );
  fprintf ( 1, '  MATLAB/Octave version %s\n', version ( ) );
  fprintf ( 1, '  levenshtein_distance() computes the Levenshtein distance\n' );
  fprintf ( 1, '  between two strings.\n' );

  s = 'water';
  t = 'wine';
  d1 = levenshtein_distance ( s, t );
  d2 = 3;
  fprintf ( 1, '\n' );
  fprintf ( 1, '  S = "%s"\n', s );
  fprintf ( 1, '  T = "%s"\n', t );
  fprintf ( 1, '  Computed distance = %d, correct distance = %d\n', d1, d2 );

  s = 'kitten';
  t = 'sitting';
  d1 = levenshtein_distance ( s, t );
  d2 = 3;
  fprintf ( 1, '\n' );
  fprintf ( 1, '  S = "%s"\n', s );
  fprintf ( 1, '  T = "%s"\n', t );
  fprintf ( 1, '  Computed distance = %d, correct distance = %d\n', d1, d2 );

  s = 'saturday';
  t = 'sunday';
  d1 = levenshtein_distance ( s, t );
  d2 = 3;
  fprintf ( 1, '\n' );
  fprintf ( 1, '  S = "%s"\n', s );
  fprintf ( 1, '  T = "%s"\n', t );
  fprintf ( 1, '  Computed distance = %d, correct distance = %d\n', d1, d2 );

  s = 'pheromones';
  t = 'photographer';
  d1 = levenshtein_distance ( s, t );
  d2 = 8;
  fprintf ( 1, '\n' );
  fprintf ( 1, '  S = "%s"\n', s );
  fprintf ( 1, '  T = "%s"\n', t );
  fprintf ( 1, '  Computed distance = %d, correct distance = %d\n', d1, d2 );
%
%  Terminate.
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'levenshtein_distance_test():\n' );
  fprintf ( 1, '  Normal end of execution.\n' );
  fprintf ( 1, '\n' );
  timestamp ( );

  rmpath ( '../levenshtein_distance' );

  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

