function dist_table_check_test ( prefix )

%*****************************************************************************80
%
%% dist_table_check_test() tests dist_table_check().
%
%  Discussion:
%
%    Read a distance matrix and check it for consistency.
%
%  Licensing:
%
%    This code is distributed under the MIT license. 
%
%  Modified:
%
%    19 May 2016
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    string PREFIX, the common file prefix.
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'dist_table_check_test():\n' );
  fprintf ( 1, '  dist_table_check(): checks a distance table.\n' );

  dist_table_filename = sprintf ( '%s_dist.txt', prefix );

  fprintf ( 1, '\n' );
  fprintf ( 1, '  The distance table filename is "%s"\n', dist_table_filename );

  [ n1, n2 ] = r8mat_header_read ( dist_table_filename );

  if ( n1 ~= n2 )
    fprintf ( 1, '\n' );
    fprintf ( 1, '  The distance table is not square.\n' );
    return;
  end

  n = n1;
  fprintf ( 1, '\n' );
  fprintf ( 1, '  The number of data items is %d\n', n );

  dist_table = r8mat_data_read ( dist_table_filename, n, n );

  check = dist_table_check ( n, dist_table );

  fprintf ( 1, '\n' );
  if ( check == 0 )
    fprintf ( 1, '  0: The distance table passed all checks.\n' );
  elseif ( check == 1 )
    fprintf ( 1, '  1: The table failed the nonnegativity check.\n' );
  elseif ( check == 2 )
    fprintf ( 1, '  2: The table failed the zero self-distance check.\n' );
  elseif ( check == 3 )
    fprintf ( 1, '  3: The table failed the symmetry check.\n' );
  elseif ( check == 4 )
    fprintf ( 1, '  4: The table failed the triangle check.\n' );
  end

  return
end
