function brc_data_test ( )

%*****************************************************************************80
%
%% brc_data_test() test brc_data().
%
%  Licensing:
%
%    This code is distributed under the MIT license. 
%
%  Modified:
%
%    20 October 2024
%
%  Author:
%
%    Original C version by Danny van Kooten.
%    This version by John Burkardt.
%
%  Local:
%
%    integer n: the number of observations to generate.
%
  addpath ( '../brc_data' );

  timestamp ( );

  fprintf ( 1, "\n" );
  fprintf ( 1, "brc_data_test():\n" );
  fprintf ( 1, "  MATLAB/Octave version %s\n", version ( ) );
  fprintf ( 1, "  Generate data for the billion record challenge.\n" );

  n = 100000;

  tstart = tic ( );
  [ c, t ] = brc_data ( n );
  tstop = toc ( tstart );
  fprintf ( 1, "  Run time was %g seconds.\n", tstop );
%
%  This is where cell-array magic would make life simple.
%  But the amateur can't figure out from the cell-array documentation
%  how to patch together a string and a number in a sensible way.  
%  So let's just use an axe.
%
%  Oh, but it's WORSE in Octave!  Almost impossible to read a file
%  containing string and numeric data.  So separate everything!
%
  filename = 'city_obs.csv';
  output = fopen ( filename, 'wt' );
  for i = 1 : n
    fprintf ( output, '"%s"\n', c{i} );
  end
  fclose ( output );
  fprintf ( 1, '  Observations written to "%s"\n', filename );

  filename = 'temp_obs.csv';
  output = fopen ( filename, 'wt' );
  for i = 1 : n
    fprintf ( output, '%g\n', t(i) );
  end
  fclose ( output );
  fprintf ( 1, '  Observations written to "%s"\n', filename );

  fprintf ( 1, "  Number of observations is %d.\n", n );
%
%  Terminate.
%
  fprintf ( 1, "\n" );
  fprintf ( 1, "brc_data_test():\n" );
  fprintf ( 1, "  Normal end of execution.\n" );

  timestamp ( );

  rmpath ( '../brc_data' );

  return
end
function timestamp ( )

%*****************************************************************************80
%
%% timestamp() prints the YMDHMS date as a timestamp.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    14 November 2022
%
%  Author:
%
%    John Burkardt
%
  t = now ( );
  c = datevec ( t );
  s = datestr ( c, 0 );
  fprintf ( 1, '%s\n', s );

  return
end
