% Tests myifC and myiffor.

% Note use of 'fprintf' statement.

% Turn on paging .
more on

fprintf('Testing myifC\n\n');
ncorrect = 0;
ntotal = 0;
for ii = 1 : 3
   for jj = 1 : 3
      for kk = 1 : 3
         fprintf('myifC(%g,%g,%g) = %g\n', ii, jj, jj, ...
            myifC(ii,jj,kk));
         % Check result using builtin function max(), supplying the 
         % "in-place" row vector of values [ii, jj, kk].
         if max([ii, jj, kk]) == myifC(ii, jj, kk)
            ncorrect = ncorrect + 1;
         end
         ntotal = ntotal + 1;
      end
   end
end
fprintf('%d of %d computed values were correct.\n', ncorrect, ntotal);

fprintf('Testing myiffor\n\n');
fprintf('Expect a length-10 row vector of all 2''s.\n');
myiffor(1,10,2)
fprintf('Expect a length-10 column vector of all 2''s.\n');
myiffor(-1,10,2)
fprintf('Expect the scalar 0.\n');
myiffor(0,10,2)
