function testt(flag)
% testt( [flag] )
% Tests the packages: m, sequence, subdivision, tjsr
% if flag is 1, then the functions in the package are tested.
%
% Written by: tommsch, 2018

%#ok<*NOPRT>
%#ok<*ASGLU>
%#ok<*NASGU>

if(nargin>=1 && flag); selftestt; return; end;

vprintf('Either start the function with argument <1> or read the source code of this file.\n'); 
return; 
2; %#ok<UNRCH>

end

function selftestt
    vprintf('tommschs packages will be tested. All output on the screen should be followed by an explanation.\n','cpr',[.1 .4 .1]);
    vprintf('If there is some error or un-commented output, the test fails.\n\n','cpr',[.1 .4 .1]);
    
    vprintf('Test tjsr-package\n=================\n','cpr',[0.3 0 0.3]);           tjsrbad=0;          try; testtjsr(1);           catch; tjsrbad=1;           end;
    vprintf('Test m-package\n=================\n','cpr',[0.3 0 0.3]);              mbad=0;             try; testm(1);              catch; mbad=1;              end;
    vprintf('Test sequence-package\n=================\n','cpr',[0.3 0 0.3]);       sequencebad=0;      try; testsequence(1);       catch; sequencebad=1;       end;
    vprintf('Test subdivision-package\n=================\n','cpr',[0.3 0 0.3]);    subdivisionbad=0;   try; testsubdivision(1);    catch; subdivisionbad=1;    end;
    vprintf('Test tmisc-package\n=================\n','cpr',[0.3 0 0.3]);          tmiscbad=0;         try; testtmisc(1);              catch; tmiscbad=1;          end;

    if(tjsrbad);        vprintf('\n\ntjsr-package test run did not succeed.\n\n','cpr','err');          end;
    if(mbad);           vprintf('\n\nm-package test run did not succeed.\n\n','cpr','err');             end;
    if(sequencebad);    vprintf('\n\nsequence-package test run did not succeed.\n\n','cpr','err');      end;
    if(subdivisionbad); vprintf('\n\nsubdivision-package test run did not succeed.\n\n','cpr','err');   end;
    if(tmiscbad);       vprintf('\n\ntmisc-package test run did not succeed.\n\n','cpr','err');         end;
end


function dummy; end %#ok<DEFNU> %Generates an error, if the 'end' of a function is missing. 
