%% Test Input Validation of Function
% Use verifyError to test if a function properly reacts to invalid inputs.
% In a file in your current folder, create the add5 function. The function accepts a numeric input and increments it by five. If called with a nonnumeric input, the function throws the exception specified by "add5:InputMustBeNumeric".
% function y = add5(x)
% % add5 - Increment input by 5
% if ~isa(x,"numeric")
%     error("add5:InputMustBeNumeric","Input must be numeric.")
% end
% y = x + 5;
% end
% Create a test case for interactive testing, and then verify that add5 throws the specified exception if it is called with the input '0'.

testCase = matlab.unittest.TestCase.forInteractiveUse;
verifyError(testCase,@() add5('0'),"add5:InputMustBeNumeric")

% Copyright 2020 The MathWorks, Inc.