function thue_ternary_next_test ( )

%*****************************************************************************80
%
%% thue_ternary_next_test() tests thue_ternary_next().
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    13 April 2009
%
%  Author:
%
%    John Burkardt
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'thue_ternary_next_test():\n' );
  fprintf ( 1, '  thue_ternary_next() returns the next \n' );
  fprintf ( 1, '  Thue ternary sequence.\n' );
  fprintf ( 1, '\n' );

  n = 1;
  thue(1) = 1;
  fprintf ( 1, '  %2d  ', n );
  for i = 1 : n
    fprintf ( 1, '%1d', thue(i) );
  end
  fprintf ( 1, '\n' );

  for i = 1 : 5
    [ n, thue ] = thue_ternary_next ( n, thue );
    fprintf ( 1, '  %2d  ', n );
    for i = 1 : n
      fprintf ( 1, '%1d', thue(i) );
    end
    fprintf ( 1, '\n' );
  end

  return
end
