function boundary_is_legal_test ( )

%*****************************************************************************80
%
%% boundary_is_legal_test() tests boundary_is_legal().
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    30 June 2021
%
%  Author:
%
%    John Burkardt
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'boundary_is_legal_test():\n' );
  fprintf ( 1, '  MATLAB/Octave version %s\n', version ( ) );
  fprintf ( 1, '  boundary_is_legal() checks whether a polyhex\n' );
  fprintf ( 1, '  boundary word is legal.\n' );
  fprintf ( 1, '\n' );
  fprintf ( 1, '                  Name     Boundary word       Legal?\n' );
  fprintf ( 1, '\n' );

  for k = 1 : 7
    [ w, p ] = tetrahex_word ( k );
    name = tetrahex_name ( k );
    legal = boundary_is_legal ( w, p );
    tf = boolean_to_string ( legal );
    fprintf ( 1, '  %20s  %20s    %s\n', name, ['"', w, '"'], tf );
  end
%
%  Use an illegal character in the word.
%
  w = '123230323456560656';
  p = [ 0, 0 ];
  name = 'Illegal character';
  legal = boundary_is_legal ( w, p );
  tf = boolean_to_string ( legal );
  fprintf ( 1, '  %20s  %20s    %s\n', name, ['"', w, '"'], tf )
%
%  3 and 6 don't match.
%
  w = '123232323456565356';
  p = [ 0, 0 ];
  name = '3 and 6 do not match';
  legal = boundary_is_legal ( w, p );
  tf = boolean_to_string ( legal );
  fprintf ( 1, '  %20s  %20s    %s\n', name, ['"', w, '"'], tf )
%
%  Illegal nonunit step.
%
  w = '123234356565656232';
  p = [ 0, 0 ];
  name = 'Nonunit step';
  legal = boundary_is_legal ( w, p );
  tf = boolean_to_string ( legal );
  fprintf ( 1, '  %20s  %20s    %s\n', name, ['"', w, '"'], tf )
%
%  Terminate.
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'boundary_is_legal_test():\n' );
  fprintf ( 1, '  Normal end of execution.\n' );

  return
end

