% octave plot error test case 2016-06-01
% Octave version 4.0.2 on Debian testing 64-bit
% Error occurs randomly suggesting that this may be a threading problem.
% This script attempts to quickly generate multiple plots to increase the chance 
% of the error occurring in any single run.

% Example of error thrown:
%error: octave_base_value::convert_to_str_internal (): wrong type argument '<unknown type>'
%error: called from
%    __line__ at line 117 column 21
%    line at line 56 column 8
%    __plt__>__plt2vv__ at line 500 column 10
%    __plt__>__plt2__ at line 246 column 14
%    __plt__ at line 113 column 17
%    plot at line 222 column 10
%    plot_string_error at line 29 column 5

% cleanup
close all
clear all
clc

% graphics toolkits - error should only occur for qt
graphics_toolkit("qt")
%graphics_toolkit("gnuplot")
%graphics_toolkit("fltk")

% data to plot
x1 = [1:1000];
x2 = x1 .* x1;

% figure counter
figureCount = 1;

% Plotting 10 figures where each figure has multiple lines
for ii = 1:10
  figure(figureCount)
  figureCount += 1;
  
  for jj = 1:10
    plot(x1, (x2 + jj) )
    hold all
  endfor
endfor