function vin_code_test ( )

%*****************************************************************************80
%
%% vin_code_test() tests vin_code().
%
%  Licensing:
%
%    This code is distributed under the MIT license. 
%
%  Modified:
%
%    23 May 2026
%
%  Author:
%
%    John Burkardt
%
%  Reference:
%
%    John D Cook,
%    Vehicle Identification Number (VIN) Check Sum,
%    https://www.johndcook.com/blog/2019/09/12/vin-check-sum/
%    12 September 2019.
%
%    John D Cook,
%    Computing VIN Checksums,
%    https://www.johndcook.com/blog/2022/09/04/computing-vin-checksums/
%    09 September 2022.
%
  addpath ( '../vin_code' );

  timestamp ( );
  fprintf ( 1, '\n' );
  fprintf ( 1, 'vin_code_test():\n' );
  fprintf ( 1, '  MATLAB/Octave version %s\n', version ( ) );
  fprintf ( 1, '  vin_code() verifies a Vehicle Identification Number (VIN).\n' );
  fprintf ( 1, '\n' );
%
%  MATLAB strings (delimited by double quotes) are great for making 
%  arrays of strings of possibly variable length.
%  They are HELL for trying to write simple computations, so I have instantly
%  converted them to character arrays.
%
  vin_strings = [ ...
    "11111111111111111", ...
    "5GZCZ43D13S812715", ...
    "1M8GDM9AXKP042788", ...
    "2M8GDM9AXKP042788", ...
    "1M8GDM9AXKPO42788" ];

  for vin = vin_strings
    vin_char = char ( vin );
    fprintf ( 1, '"%s"', vin_char );
    fprintf ( 1, '  %s', checksum ( vin_char ) );
    fprintf ( 1, '  %s\n', mat2str ( validate ( vin_char ) ) );
  end
%
%  Terminate.
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'vin_code_test():\n' );
  fprintf ( 1, '  Normal end of execution.\n' );
  timestamp ( );
  rmpath ( '../vin_code' );

  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

