% testBoxOfx.m test boxOfx.m % P. Conrad for CISC106, sect 99, 10/07/2007 % Test function to produce a box of the letter x %%%%%%%%%%%%%%%%% % Run the tests % %%%%%%%%%%%%%%%%% % Test 1 actual = boxOfx(3); expected = ['xxx';'xxx';'xxx']; if (actual == expected) disp('test 1 passed'); else disp('test 1 failed'); expected actual end % Test 2 actual = boxOfx(5); expected = ['xxxxx';'xxxxx';'xxxxx';'xxxxx';'xxxxx']; if (actual == expected) disp('test 2 passed'); else % signal that test failed, and print both expected and actual disp('test 2 failed'); expected actual end % Test 3 actual = boxOfx(-7); expected = []; % if (actual == expected) does not work. % must be replaced with something else % See lab06.html for hints... if (actual==expected) disp('test 3 passed'); else % signal that test failed, and print both expected and actual disp('test 3 failed'); expected actual end % end testBoxOfx.m