%A test suite for validateID

%How to use the validateID function in the
%same way we did in the previous video
%done = 0;
%while ~done
%  id = input('Enter your employee ID: ');
%  if validateID(id)
%   done = 1; 
%  end
%end

%Set of test cases:
%Every line of code should be hit at least once in this set of tests.
%Good cases
testcase = 1234567;
if validateID(testcase) ~= 1
  fprintf('Failed to validate ID properly when input was %d\n', testcase);
end

%Bad cases
%No input
%Tries to run the code, if there is an error, puts the error err.
try
  testcase = [];
  if validateID(testcase) ~= 0
    fprintf('Failed to validate ID properly when input was empty\n');
  end
catch err
  disp(err.message);
end

%Floating point input
testcase = 1234567.8;
if validateID(testcase) ~= 0
  fprintf('Failed to validate ID properly when input was %f\n', testcase);
end

%Vector input
testcase = [1,2];
try
  if validateID(testcase) ~= 0
    fprintf('Failed to validate ID properly when input was empty\n');
  end
catch err
  disp(err.message)
end

%Character input
testcase = 'a';
if validateID(testcase) ~= 0
  fprintf('Failed to validate ID properly when input was %s\n', testcase);
end

%Corner cases
testcase = 1000000;
if validateID(testcase) ~= 1
  fprintf('Failed to validate ID properly when input was %d\n', testcase);
end

testcase = 9999999;
if validateID(testcase) ~= 1
  fprintf('Failed to validate ID properly when input was %d\n', testcase);
end

